Re: Date Conversions?
| From: | Greg Donald | Date: | Mon, 15 Nov 2004 20:17:01 +0000 |
| Subject: | Re: Date Conversions? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202085@lists.php.net to get a copy of this message | ||
On Mon, 15 Nov 2004 14:29:59 -0500, Robert Sossomon
<robert_sossomon@ncsu.edu> wrote:
> I have a date in format YY-MM-DD in a MySQL table. I need to pull it back to
> display it in either format: MM-DD-YY or Month Day, Year format.
>
> I can't figure out how to write the query to do it, and am not sure how to make
> PHP just parse the one given and dump it back out in the way I need it. Any
> suggestions?
In PHP you can take it apart and put it back together.
$date = explode('-', $array['date']);
If it's an actual date or time field in MySQL, you can use
date_format() to reformat it in the query and skip the PHP.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/