Re: Easiest way to convert date?
| From: | Nick Eby | Date: | Wed, 23 Oct 2002 23:07:36 +0000 |
| Subject: | Re: Easiest way to convert date? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121177@lists.php.net to get a copy of this message | ||
you can get rid of that substr dirty work and do it in a one-liner:
$date = "2002-10-23 16:05:30";
echo date("M j, Y h:i a", strtotime($date));
"Megalion" <php@megandodson.com> wrote in message
news:200210232259.g9NMxL187494@email.featureprice.com...
>
> Yes but that doesn't always work for all of us. It doesn't work when
you're doing a "SELECT * FROM database";
>
> I just write a function that'll convert the DATETIME field into the
desired date format I want and then call it whenever i go to display the
date.
>
> In the function, I just did it the dirty way which was to use substr to
break up the date and put it together the way I wanted but YMMV
>
> Megalion
>