i need to separate this date like :
November 5, 2006
Sunday, 12:00 pm
which php function can help me in conversion of this date : 2006-11-05T12:00:00
date sepration issue
Moderator: General Moderators
Code: Select all
<?php
$date = "2006-11-05T12:00:00";
$convert_date = strtotime($date);
echo date("F d, Y", $convert_date).'<br>'.date("l, h a", $convert_date);
?>strtotime can parse the iso 8601 format. But your string is not valid iso 8601. You need to add a zone designator.
If your timestamps are UTC add Z, e.g. 2006-11-05T12:00:00Z
My current timezone is gmt+1 -> 2006-11-05T12:00:00+01:00
...
Even simpler: You can ask date() for the "right" designator
If your timestamps are UTC add Z, e.g. 2006-11-05T12:00:00Z
My current timezone is gmt+1 -> 2006-11-05T12:00:00+01:00
...
Even simpler: You can ask date() for the "right" designator
http://de2.php.net/manual/en/function.date.php wrote:P Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3) Example: +02:00
Code: Select all
<?php
$zd = date('P');
$date = "2006-11-05T12:00:00";
$convert_date = strtotime($date.$zd);
echo date("F d, Y", $convert_date).'<br>'.date("l, h a", $convert_date);
?>