Make WordPress Core

Ticket #42542: mysql_to_rfc3339.patch

File mysql_to_rfc3339.patch, 1.3 KB (added by Rarst, 6 years ago)
  • wp-includes/functions.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    54825482}
    54835483
    54845484/**
    5485  * Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601/RFC3339.
     5485 * Parses and formats a MySQL datetime (Y-m-d H:i:s) for ISO8601 ('Y-m-d\TH:i:s').
    54865486 *
    54875487 * Explicitly strips timezones, as datetimes are not saved with any timezone
    54885488 * information. Including any information on the offset could be misleading.
    54895489 *
     5490 * Despite historical function name output does not conform to RFC3339 format,
     5491 * which must contain time zone.
     5492 *
    54905493 * @since 4.4.0
    54915494 *
    54925495 * @param string $date_string Date string to parse and format.
    5493  * @return string Date formatted for ISO8601/RFC3339.
     5496 * @return string Date formatted for ISO8601 without time zone.
    54945497 */
    54955498function mysql_to_rfc3339( $date_string ) {
    5496         $formatted = mysql2date( 'c', $date_string, false );
    54975499
    5498         // Strip timezone information
    5499         return preg_replace( '/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted );
     5500        return mysql2date( 'Y-m-d\TH:i:s', $date_string, false );
    55005501}
    55015502
    55025503/**