mdl_user table EPOCH Date fields

mdl_user table EPOCH Date fields

- Kelly Turner の投稿
返信数: 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,

Kelly Turner への返信

Re: mdl_user table EPOCH Date fields

- Tim Hunt の投稿
画像 Core developers 画像 Documentation writers 画像 Particularly helpful Moodlers 画像 Peer reviewers 画像 Plugin developers
I think these days the lastaccess and lastlogin files are stored in a separate table user_lastaccess or something, for performance reasons.
Kelly Turner への返信

Re: mdl_user table EPOCH Date fields

- Eloy Lafuente (stronk7) の投稿
画像 Core developers 画像 Documentation writers 画像 Moodle HQ 画像 Particularly helpful Moodlers 画像 Peer reviewers 画像 Plugin developers 画像 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 笑顔
Kelly Turner への返信

Re: mdl_user table EPOCH Date fields

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

Chetan Sharma への返信

Re: mdl_user table EPOCH Date fields

- G. M. の投稿
G. M. への返信

Re: mdl_user table EPOCH Date fields

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

Chetan Sharma への返信

Re: mdl_user table EPOCH Date fields

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