Re: date() formatting
| From: | Charles Killian | Date: | Wed, 23 Aug 2000 20:37:13 +0000 |
| Subject: | Re: date() formatting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-13213@lists.php.net to get a copy of this message | ||
Or try this with the timestamp format:
date("D M d, Y H:i:s", strtotime($rs["date"]));
strtotime() is a wonderful fuction.
Charlie
----- Original Message -----
Sent: Wednesday, August 23, 2000 1:30 PM
Subject: Re: [PHP] date() formatting
> I have a field of type datetime. I would like to format the record so that
> it displays for example, 'Wed, August 23, 2000 12:40:33' I already tried
> doing date("D M d, Y H:i:s", $rs["date"]) but I keep getting Jan 01, 1970
I think this will work:
The date is fine, but how you get the date is the issue (it is not in
UNIX epoch format).
modify your query so that you get the date field like this:
SELECT UNIX_TIMESTAMP(date) as date;
This this will work.
date("D M d, Y H:i:s", $rs["date"])
-jeremy brand
_______________________________________________________________________
GnuPG Fingerprint: 9F5E 95E0 1CC2 E054 84EA 6099 8ACD 9DBA D2C0 5EA9
_ http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html
for more __
> 00:33:20 date. There is no problem with pulling the record as it displays
> the MMMM-YY-DD HH:II:SS format. Is there anything I am missing or doing
> wrong? Thanks.
>
> O.J. Alcaraz
> Abaris Technologies
> Voice: (858) 550-0567 x118
> Fax: (858) 550-0564
>
> --
> 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
>
>
--
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