PHP date_format() Function
Example
Returns a new DateTime object and then formats the date:
<?php $date=date_create("2016-09-25"); echo date_format($date,"Y/m/d H:i:s"); ?>
Definition and Usage
The date_format() function returns a formatted date based on the specified format.
Syntax
date_format(object,format);
Parameter | Description |
---|---|
object | Required. Specifies by date_create() Returns the DateTime object. |
format | Required. Specifies the format of the date. |
Technical Details
Return Value: | Returns a formatted date string. Returns FALSE if it fails. |
---|---|
PHP Version: | 5.2+ |