[plug] php4 mysql date functions.

Shayne shayne at guild.murdoch.edu.au
Tue Dec 10 04:06:43 WST 2002


Erm.... Oh yea re;- DG_GetRecords function.. It's just a sql wrapper in a 
custom lib.... 

Still stumped tho.

On Monday 09 December 2002 11:17, shayne oneill wrote:
> 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