[thelist] php getdate() always returns 1969-12-31 19:59:00

Mr. Tenuta dtportnoy at videotron.ca
Wed Aug 25 23:33:47 CDT 2004


Hi Sarah,

> 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.

I've just been working with some date functions luckily. Are you just
printing getdate() straight? What getdate() does is takes the current time
and puts it into an array. ex:

$dateA = getdate();

echo $dateA["mon"] . "-" . $dateA["hours"] etc...

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

There's an example. The manual tells you more in detail what each value
passed in the string paramater of the date function does. Hope that helps a
little.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Lawrence Tenuta @ neoDesignz
http://www.neodesignz.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-




More information about the thelist mailing list