Re: Date format question
| From: | John W. Holmes | Date: | Tue, 25 Nov 2003 02:54:20 +0000 |
| Subject: | Re: Date format question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170839@lists.php.net to get a copy of this message | ||
Manisha Sathe wrote:
I have a date returned from MySQL in 'YYYY-MM-DD' format, i want to show this date in 'DD/MM/YYYY' format using PHP, date() function does the same if i pass timestamp in int format, but how to convert into int timestamp ? e.g from '2003-11-25' to '20031125' ? and Then I believe that i can use date ("d/m/Y", '20031125' ) to the things done ?No, date() expects a unix timestamp. You can either use SELECT UNIX_TIMESTAMP(your_column) AS foo FROM Table ... and then use the value in column 'foo' in date(), or just use DATE_FORMAT() in your query to retrieve the row already formatted. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com