[plug] php4 mysql date functions.

shayne oneill shayne at guild.murdoch.edu.au
Mon Dec 9 18:17:20 WST 2002


Ok. I'm stumped.

I need to insert dates and times into a datetime field in a mysql database,
and get a sensible string back on retrieval.

Can anyone tell me whats wrong with this (other than no err checks.. I'm
getting there!)

Putting date in;-

        $stamp=mktime($hour,$minute,0,$month,$day,$year);
        $published=1;
        DG_GetRecords ("INSERT INTO actions(actionname,actiondescription,
groupid,datetime,contactdetails,published) VALUES
('$name','$description',$groupid,$stamp,'$contactdetails',$published)");

And retrieving it.....

echo date("D M j G:i:s T Y",$row[4])

(Row  4 of course being from the above insert)..

I just get crazy dates unfortunately. Mostly in the seventies and with
improbable times of day..

Any clues where I'm screwin up?

Shayne



More information about the plug mailing list