[thelist] PHP/MySQL Date Format Help

Simon Perry thelist at si-designs.co.uk
Wed Aug 4 09:24:57 CDT 2004


jsWalter wrote:

>>-----Original Message-----
>>From: thelist-bounces at lists.evolt.org 
>>[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Rob Smith
>>Sent: Wednesday, August 04, 2004 8:28 AM
>>To: Thelist (E-mail)
>>Subject: [thelist] PHP/MySQL Date Format Help
>>
>>
>>Hi,
>>
>>I had a problem last night that I thought you could help me 
>>with. If you've ever worked with php/mysql and the date 
>>format, you've probably seen the format like YYYY-MM-DD...
>>    
>>
>
>
>This is what I made and use.
>
>This can be easily "fixed" to handle PHP date formats.
>
>  
>
With a little less reinvention of the wheel...
<?php
$date="2004-08-01";
list($year,$month,$day)=split("-",$date);
$display_date=date("l d F Y",mktime(0,0,0,$month,$day,$year));
echo $display_date;
?>
Will display the following to the screen
Sunday 01 August 2004

See the PHP manual[0] for full details of each function.

Simon

[0]
http://uk2.php.net/split
http://uk2.php.net/date
http://uk2.php.net/mktime


More information about the thelist mailing list