[thelist] php getdate() always returns 1969-12-31 19:59:00
Sarah Sweeney
mr.sanders at designshift.com
Thu Aug 26 00:07:19 CDT 2004
>>I'm trying to output the date using PHP, but for some reason the
>>getdate() function always returns 1969-12-31 19:59:00 (I assume that's
>>1969-12-31 23:59:00 GMT). I've googled and haven't come up with any
>>explanation for this problem. Any idea what I'm doing wrong? Feel free
>>to tell me if I'm being a total dumb*ss, I don't have lots of experience
>>with PHP.
>
<snip>
>
> I think you want to be using the date function. Everything you need to know
> about PHP is easily found in their documentation. I find they have the best
> explanations.
>
> http://ca.php.net/manual/en/function.date.php
>
> echo date("m-d-Y H:i:s");
> // prints out the current date in this format Aug 9, 2004 15:03:01
I guess the manual wasn't clear enough to get this idea across to me :(
I was actually using:
date('M j, Y g:i a',getdate());
// returned "Dec 31, 1969 7:59 pm"
But changing it to this, as you suggested, works:
date('M j, Y g:i a');
// returns "Aug 26, 2004 2:06 am" (time for bed!)
Thanks, Lawrence!
--
Sarah Sweeney
Web Developer & Programmer
Portfolio :: http://sarah.designshift.com
Blog, etc :: http://hardedge.ca
More information about the thelist
mailing list