関数 get_gmt_from_date()
2014/12/11
関数 get_gmt_from_date()
定義ファイル :/blog/wp-includes/formatting.php 5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | function get_gmt_from_date( $string, $format = 'Y-m-d H:i:s' ) { $tz = get_option( 'timezone_string' ); if ( $tz ) { $datetime = date_create( $string, new DateTimeZone( $tz ) ); if ( ! $datetime ) return gmdate( $format, 0 ); $datetime->setTimezone( new DateTimeZone( 'UTC' ) ); $string_gmt = $datetime->format( $format ); } else { if ( ! preg_match( '#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches ) ) return gmdate( $format, 0 ); $string_time = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] ); $string_gmt = gmdate( $format, $string_time - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); } return $string_gmt; } |