Re: Re: Formatting timestamp date in MySQL
| From: | Richard Baskett | Date: | Fri, 12 Apr 2002 12:24:22 +0000 |
| Subject: | Re: Re: Formatting timestamp date in MySQL | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92752@lists.php.net to get a copy of this message | ||
No problemo! Do this:
select DATE_FORMAT(tidsstampel, '%W %M %Y');
There you go!
Rick
"When a man won't listen to his conscience, it's usually because he doesn't
want advice from a total stranger." - Lindsey Stewart
> From: "Michael Andersson" <chrazy@hotpop.com>
> Date: Fri, 12 Apr 2002 14:21:28 +0200
> To: php-general@lists.php.net
> Subject: [PHP] Re: Formatting timestamp date in MySQL
>
> I´m kind of new to this mysql stuff but anyway...
>
> I have a row in a table with a timestamp of 14 chars and i dont know how to
> convert the row named 'tidsstampel' into something like this:
>
> select DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');
>
> i dont wanna use a static date for this, id rather use a variable that i get
> from the dbase..
>
> anyone getting this or is it just ribberish?
>
> /Micke
>
> "Mike Robinson" <mrobinson@torontostartv.com> skrev i meddelandet
> news:20020410171301.21580.qmail@pb1.pair.com...
>> You should consider using mysql's built-in DATE_FORMAT function.
>> Why pull data, parse it, and format it, when you can retrieve it formatted
>> the way you want in one call. Double/triple handling of data is a bad
> thing.
>>
>>
>> "Nyon" <ycnyon@pd.jaring.my> wrote in message
>> news:001c01c1dfbd$a7403320$7464a8c0@tm.net.my...
>> Hi,
>>
>> I need to recall a date data in a MySQL database.
>> The column is set as "date timestamp(8)".
>> A sample of date is "20020409"
>>
>> I use the PHP Date function to format it back to say "9th April 2002".
>> $date_formated = date($date, 'S M Y' );
>> However, it's still doesn't appear as formatted.
>>
>> Anyone mind sharing their code to do this?
>>
>> Nyon
>>
>>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>