WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/iso8601 to datetime

Description

Converts an iso8601 date to MySQL DATETIME format used by post_date[_gmt].

Usage

<?php iso8601_to_datetime$date_string$timezone ?>

Parameters

$date_string
(string) (required) Date and time in ISO 8601 format.
Default: None
$timezone
(string) (optional) If set to GMT returns the time minus gmt_offset. Default is 'user'.
Default: 'user'

Return Values

(string) 
The date and time in MySQL DATETIME format - Y-m-d H:i:s.

Examples

Notes

Change Log

Since: 1.5.0

Source File

iso8601_to_datetime() is located in wp-includes/formatting.php.

Related

See also index of Function Reference and index of Template Tags.