Easy Tutorial
❮ Php Intro Func Curl_Escape ❯

PHP date_create_from_format() Function

PHP Date/Time Reference Manual

Example

Returns a new DateTime object formatted according to the specified format:


Definition and Usage

The date_create_from_format() function returns a new DateTime object formatted according to the specified format.

Syntax

Parameter Description
format Required. Specifies the format to use. The format parameter string can use the following characters: d - Day of the month with leading zero<br> j - Day of the month without leading zero<br> D - Day of the week (Mon - Sun)<br> l - Day of the week (Monday - Sunday)<br> S - English ordinal suffix for the day of the month (st, nd, rd, th)<br> F - Full month name (January - December)<br> M - Short month name (Jan - Dec)<br> m - Month (01 - 12)<br> n - Month (1 - 12)<br> Y - Year (e.g., 2013)<br> y - Year (e.g., 13)<br> a and A - am or pm<br> g - 12-hour format without leading zero<br> h - 12-hour format with leading zero<br> G - 24-hour format without leading zero<br> H - 24-hour format with leading zero<br> i - Minutes with leading zero<br> s - Seconds with leading zero<br> u - Microseconds (up to six digits)<br> e, O, P, and T - Timezone identifier<br> U - Seconds since the Unix Epoch<br> (space)<br> # - One of the following separators: ;, :, /, ., ,, -, (, )<br> ? - A random byte<br> * - Random bytes until the next separator/digit<br> ! - Resets all fields to Unix Epoch<br> - Resets all fields to Unix Epoch if not already parsed<br> + - If present, trailing data in the string will cause a warning, not an error
time Required. Specifies a date/time string. NULL indicates the current date/time.
timezone Optional. Specifies the timezone of time. Defaults to the current timezone.

Technical Details

Return Value: Returns a DateTime object on success, FALSE on failure.
PHP Version: 5.3+
--- ---
❮ Php Intro Func Curl_Escape ❯