Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601 (Y-m-d\TH:i:s).
Description
Explicitly strips timezones, as datetimes are not saved with any timezone information. Including any information on the offset could be misleading.
Despite historical function name, the output does not conform to RFC3339 format, which must contain timezone.
Parameters
$date_string
stringrequired- Date string to parse and format.
Source
function mysql_to_rfc3339( $date_string ) {
return mysql2date( 'Y-m-d\TH:i:s', $date_string, false );
}
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.