Exporting Data to MS Access - in particular "sessdate"

Exporting Data to MS Access - in particular "sessdate"

by Duncan Edwards -
Number of replies: 2

Hi,

I am trying to write a customised MS Access application to extract data from the MySQL database about attendance, mainly because I don't know enough about PHP.  Everything is working well and my queries are great for what I need but I can't figure out the "sessdate" field in the mdl_attendance_sessions table.  The formatting on my database gives a value such as 1156978800 or 1157065200.  The date appears correctly on the Moodle pages but I don't know how to make these number make sense.  I understood from searching these forums the date is d,m,y but this doesn't work.

Here is the code I am looking at from add.php for the generation of the sessdate field.

if ($mode === 'one') {
  $sday    = required_param('sday', PARAM_INT);
  $smonth   = required_param('smonth', PARAM_INT);
  $syear    = required_param('syear', PARAM_INT);  
  $desc    = required_param('desc');  
  $sessdate   = mktime(0, 0, 0, $smonth, $sday, $syear);

Can anyone help?  How do I interpret these numbers in the table?

I have attached a screen dump of access so you can see the table.

Many thanks,

Duncan

Attachment mdlsess.jpg
Average of ratings: -
In reply to Duncan Edwards

Re: Exporting Data to MS Access - in particular "sessdate"

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Duncan,

The sessdate field contains timestamps i.e. the number of seconds that have passed since midnight GMT on 1st January 1970. Thus 1156978800 converts to Wed, 30 Aug 2006 23:00:00 GMT. You may find the discussion How does date / time in DB convert to real Date / Time? helpful.
In reply to Helen Foster

Re: Exporting Data to MS Access - in particular "sessdate"

by Duncan Edwards -

Thank you for that.  I had looked at the Developer Forum, but clearly not put the right search criteria in.

All I need to do now is get Access to work it out!

Once again, thank you.

Duncan