PHP date_create_from_format () function
PHP Date / Time Reference Manual
Examples
Returns a formatted new DateTime object with the specified format:
<?php
$date=date_create_from_format("j-M-Y","15-Mar-2013");
?>
$date=date_create_from_format("j-M-Y","15-Mar-2013");
?>
Running instance »
Definition and Usage
date_create_from_format () function returns a formatted according to the specified format, a new DateTime object.
grammar
date_create_from_format( format,time,timezone);
参数 | 描述 |
---|---|
format | 必需。规定要使用的格式。 format 参数字符串可以使用下列的字符:
|
time | 必需。规定一个日期/时间字符串。NULL 表示当前的日期/时间。 |
timezone | 可选。规定 time 的时区。默认为当前时区。 |
technical details
return value: | If successful DateTime object, if it fails returns FALSE. |
---|---|
PHP version: | 5.3+ |
PHP Date / Time Reference Manual