Changeset 22435
- Timestamp:
- 11/07/2012 08:07:41 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/formatting.php
r22401 r22435 1893 1893 function get_gmt_from_date($string, $format = 'Y-m-d H:i:s') { 1894 1894 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); 1895 if ( ! $matches ) 1896 return date( $format, 0 ); 1897 1895 1898 $tz = get_option('timezone_string'); 1896 1899 if ( $tz ) { 1897 1900 date_default_timezone_set( $tz ); 1898 $datetime = new DateTime( $string ); 1901 $datetime = date_create( $string ); 1902 if ( ! $datetime ) 1903 return date( $format, 0 ); 1904 1899 1905 $datetime->setTimezone( new DateTimeZone('UTC') ); 1900 1906 $offset = $datetime->getOffset();
Note: See TracChangeset
for help on using the changeset viewer.