Return a new DateTime object, then format the date:
<?php$date=date_create("2013-03-15");echo date_format($date,"Y/m/d H:i:s");?>The date_format() function returns a date formatted according to the specified format.
date_format( object,format);
parameter | describe |
---|---|
object | Required. Specifies a DateTime object returned by date_create(). |
format | Required. Specifies the date format. |
Return value: | Returns a formatted date string. Returns FALSE on failure. |
---|---|
PHP version: | 5.2+ |