Re: format dates from a database
| From: | Hugh Bothwell | Date: | Sat, 18 Aug 2001 21:25:08 +0000 |
| Subject: | Re: format dates from a database | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11502@lists.php.net to get a copy of this message | ||
"Caleb Walker" <cwalker@cwalk.org> wrote in message
news:01081813054602.05392@butthead.cwalk.org...
> I am wondering if there is an easier way to format dates that come out of
a
> database. My database stores my date in the format- "YYYY-MM-DD". I know
> that I can take this and rearrange it with some string manipulation but is
> there any other easier way to do that say like making it say Sep. 09, 2001
> instead of 2001-09-09 without using ereg()?
sscanf("%d-%d-%d", $str, $year, $month, $day);
date("M. d, Y", mktime(0,0,0,$month,$day,$year));