Re: display date

From: Date: Sun, 17 Dec 2000 17:07:02 +0000
Subject: Re: display date
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30741@lists.php.net to get a copy of this message
I've found it much easier to just store all date/times into the database as INTs using gmmktime(). If your date was stored as an INT, your line of code below would work with just a simple change of date to gmdate. Plus, if you store it as an INT, it gets really easy to adjust for timezones. gmdate("M d, Y", $timestamp-$timezoneoffset); wooik@halfmind.com wrote: > > Before I asked my question, just want to let you all know that I did look > up the manual to find the answer, but can't seem to find it. > > Anyway, the problem that I have: I have a postgres database the returns a > datetime field. I want to display it as MMM DD, YYYY (e.g. Nov 15, 2000), > The following is what I have > > <?php echo date("M d, Y", $r[4]); ?> <== $r[4] contains Dec 16, 2000 > > but what I got back is "Dec 31, 1969". > > Am I missing something again?? > > wooi. > p/s Brain, if you are reading this email, just want to thank you for > answering me my previous question :-) But I did try to find the answer in > the php manual and some other php sites. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#30741) next »