This topic is locked

epoch date reporting format problem

9/14/2007 1:07:44 AM
PHPRunner General questions
L
lucky666 author

Am using PHPRunner as a reporting tool (no edit add etc) out of a mySQL d'base created by another app
Works beautifully except the date stored in the d'base is in the unix internal format.
Have tried :

  1. setting the fields as custom with 'if ($value != 0) $value = date('d M Y H:i', $value);' as code - the fields show nicely, but the Adv Search is still looking at the raw format.
  2. setting the SQL string as below -
    [codebox]select

    `mdl_user`.`username`,

    `mdl_user`.`firstname`,

    `mdl_user`.`lastname`,

    `mdl_user`.`email`,

    `mdl_user`.`city`,

    `mdl_quiz_attempts`.`id`,

    `mdl_quiz_attempts`.`attempt`,

    `mdl_quiz_attempts`.`sumgrades`,

    FROM_UNIXTIME(`mdl_quiz_attempts`.`timestart`,'%d %M %Y') as qtimestart,

    FROM_UNIXTIME(`mdl_quiz_attempts`.`timefinish`,'%d %M %Y') as qtimefinish,

    FROM_UNIXTIME(`mdl_quiz_attempts`.`timemodified`,'%d %M %Y') as qtimemodified

    From `mdl_quiz_attempts`

    inner join `mdl_user` on `mdl_quiz_attempts`.`userid`=`mdl_user`.`id`[/codebox]
    If the field is set as any sort of date format it appears blank, if set as a generic text field then it shows OK but the date search will not work.
    Anyone have any bright ideas??
    Thanks for any help you can give.
    Phil

Alexey admin 9/14/2007

Phil,
try using this expression in your SQL query:

FROM_UNIXTIME(`mdl_quiz_attempts`.`timestart`,'%Y-%M-%d')


Then set View and Edit format to Date in PHPRunner.

L
lucky666 author 9/16/2007

Alexy
Thanks for your help on this.
Tried the '%Y-%M-%d' format but it was still not recognising it - finally got it going on '%Y-%m-%d'
Thanks very much for pointing me in the right direction.
Regards
Phil