mdl_user table EPOCH Date fields

mdl_user table EPOCH Date fields

by Kelly Turner -
Number of replies: 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,

Average of ratings: -
In reply to Kelly Turner

Re: mdl_user table EPOCH Date fields

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I think these days the lastaccess and lastlogin files are stored in a separate table user_lastaccess or something, for performance reasons.
In reply to Kelly Turner

Re: mdl_user table EPOCH Date fields

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of 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 smile
In reply to Kelly Turner

Re: mdl_user table EPOCH Date fields

by 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.

In reply to Chetan Sharma

Re: mdl_user table EPOCH Date fields

by Guillermo Madero -

Hi Chetan,

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

In reply to Guillermo Madero

Re: mdl_user table EPOCH Date fields

by 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.