WPDev.one
Core Function
View Source on Trac ↗

iso8601_to_datetime()

iso8601_to_datetime( mixed $date_string, mixed $timezone = 'user' )

Given an ISO 8601 (Ymd\TH:i:sO) date, returns a MySQL DateTime (Y-m-d H:i:s) format used by post_date[_gmt].

Parameters 1 required

Name / Type Description
$date_string
string

Date and time in ISO 8601 format {@link https://en.wikipedia.org/wiki/ISO_8601}.

Required
$timezone
string

Optional. If set to 'gmt' returns the result in UTC. Default 'user'.

Return Value

((string)
| false) The date and time in MySQL DateTime format - Y-m-d H:i:s, or false on failure.

Function Information

Since Version
1.5.0
Source File
wp-includes/formatting.php
Advertisement