Re: Stumped on a function
| From: | Jason Soza | Date: | Fri, 21 Jun 2002 16:26:17 +0000 |
| Subject: | Re: Stumped on a function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-103302@lists.php.net to get a copy of this message | ||
To be honest, I didn't know I could format the date within my query.
For some reason, I was under the assumption that since dates go into
MySQL in a specific format, that's how they came out.
Anyway, thanks for pointing this out to me! Very helpful.
Jason Soza
----- Original Message -----
From: Jesper Brunholm <nospam@brunholm-scharff.dk>
Date: Friday, June 21, 2002 2:02 am
Subject: Re: [PHP] Stumped on a function
> John Holmes wrote:
> > Why don't you just use DATE_FORMAT() in your query, then you
> don't have
> > to do any extra PHP code at all??
>
> you might want a link to that:
> <"
>
target="l">http://www.mysql.com/doc/D/a/Date_and_time_functions.html>
-
look
> somewhat below the middle of the page
>
> >>function cleandate($indate) {
> >> str_replace("-", "/", $indate);
> >> return date("F j, Y", strtotime($indate));
> >> }
>
> check the $indate - response from the db - if you give invalid
> data
> there then it will (probably) use a timestamp instead, whith now()-
> values...
> >> when I echo $newdate using the above code, I get "June 20,
> 2002" -
> >> today's date.
>
> Regards
>
> Jesper Brunholm
>
> --
> Phønix - Danish folk music from young musicians -
> http://www.phonixfolk.dk
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>