mdl_user table EPOCH Date fields

mdl_user table EPOCH Date fields

por Kelly Turner -
Número de respostas: 6

I'm trying to read the data from the mdl_user table. I have converted the epoch date to a date/time format I can uderstand. It appears that the mdl_user.firstaccess field is the date/time that the user account was created. However, in most records that I look at, I see no difference between the date/times of that particular users mdl_user.lastaccess, mdl_user.lastlogin and mdl_user.currentlogin.

For example - mdl_user.id = 343, has the mdl_user.lastaccess = 2/25/2008 6:15:05 PM, mdl_user.lastlogin = 2/25/2008 3:46:12 PM, mdl_user.currentlogin = 2/25/2008 6:14:40 PM.

What is the difference between these data fields?

Thanks,

Média das avaliações:  -
Em resposta à Kelly Turner

Re: mdl_user table EPOCH Date fields

por Tim Hunt -
Imagem de Core developers Imagem de Documentation writers Imagem de Particularly helpful Moodlers Imagem de Peer reviewers Imagem de Plugin developers
I think these days the lastaccess and lastlogin files are stored in a separate table user_lastaccess or something, for performance reasons.
Em resposta à Kelly Turner

Re: mdl_user table EPOCH Date fields

por Eloy Lafuente (stronk7) -
Imagem de Core developers Imagem de Documentation writers Imagem de Moodle HQ Imagem de Particularly helpful Moodlers Imagem de Peer reviewers Imagem de Plugin developers Imagem de Testers
Hi Kelly,

if I'm not wrong these are the meaning for the three fields you are asking about:

- mdl_user.lastaccess: contains the last time the user has been active within Moodle (has performed some action). Note this field isn't updated for each "click" the user does, but

- mdl_user.currentlogin: contains the last time the user has logged-in.

- mdl_user.lastlogin: contains the "previous" last time the user has logged in (each time "currentlogin" is updated, before doing so, its value is copied to "lastlogin").

And then, as Tim commented, the table "user_lastaccess", whose lastaccess field contains the last time the user has been active (like the user one above) but BY COURSE (one record for each course the used has visited).

Ciao sorriso
Em resposta à Kelly Turner

Re: mdl_user table EPOCH Date fields

por Chetan Sharma -

Hi Kelly,

Please tell me how have you converted that to date time format. Also i wanted to know how can i get the no. of days left in user's expiration for any course.

Thanks in Advance.

Em resposta à Chetan Sharma

Re: mdl_user table EPOCH Date fields

por G. M. -

Hi Chetan,

Use the http://www.epochconverter.com/ page.

Em resposta à G. M.

Re: mdl_user table EPOCH Date fields

por Chetan Sharma -

Hi Guillermo,

Thanks for your reply.

Actually i have created a different php file in the root of moodle and i want to call the no. of days left in the expiry of user. Please help me.

Em resposta à Chetan Sharma

Re: mdl_user table EPOCH Date fields

por G. M. -

Hi Chetan,

That page includes sections with code samples in different languages; check the PHP one:

http://www.epochconverter.com/programming/functions-php.php

You could also take a look at the Moodle Enrolment plugins documentation page and at the links at the See also section of the Database schema introduction page.