Jump to content

Converting y/d/m format to longdate (e.g. 18 March 2008)


clairian

Recommended Posts

or

 

<?php
$date = '2008,18,03';
// we need to rearrange the parts for strtotime() to recognize it
$parts = explode(',', $date);
$formatted_date = date('j F Y', strtotime($parts[0].$parts[2].$parts[1]));
echo $formatted_date;
// 18 March 2008
?>

The code below has done the job.

 

Thanks - it will be a great help.

 

<?php
$date = '2008,18,03';
// we need to rearrange the parts for strtotime() to recognize it
$parts = explode(',', $date);
$formatted_date = date('j F Y', strtotime($parts[0].$parts[2].$parts[1]));
echo $formatted_date;
// 18 March 2008
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.