PHP convert time, day,month and year to a formatted string -
i have:
$date = $this->item->publish_up; echo $date
which returns: 2013-07-19 09:28:05
how can convert text, example thursday, 8th of november 2012 @ 00:00?
i have tried:
$date = $this->item->publish_up; $new_date = date('m-d-y', strtotime($date)); echo date("format",strtotime($new_date))
but returns: f1970thu, 01 jan 1970 02:00:00 +020001am31
any apreciated
you must escape o
, a
, t
.
can read more here in php manual date
function
you can prevent recognized character in format string being expanded escaping preceding backslash. if character backslash special sequence, may need escape backslash.
<?php echo date( "l, js \of f y \a\\t h:i a", strtotime( "2013-07-19 09:28:05" ) ); ?>
Comments
Post a Comment