1568 | | 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); |
1569 | | $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
1570 | | $string_gmt = gmdate($format, $string_time - get_option('gmt_offset') * 3600); |
1571 | | return $string_gmt; |
| 1569 | if( wp_timezone_supported() && $tz_string = get_option( 'timezone_string' ) ) { |
| 1570 | // PHP 5 |
| 1571 | $tz_object = timezone_open( $tz_string ); |
| 1572 | $datetime = date_create( $string, $tz_object ); |
| 1573 | $timestamp = $datetime->getTimestamp(); |
| 1574 | } |
| 1575 | else { |
| 1576 | // PHP 4 |
| 1577 | 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); |
| 1578 | $timestamp = gmmktime( $matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1] ) - get_option('gmt_offset') * 3600; |
| 1579 | } |
| 1580 | return gmdate( $format, $timestamp ); |
1587 | | 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); |
1588 | | $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]); |
1589 | | $string_localtime = gmdate($format, $string_time + get_option('gmt_offset')*3600); |
1590 | | return $string_localtime; |
| 1596 | if( wp_timezone_supported() ) { |
| 1597 | // PHP 5 |
| 1598 | $timezone_object = timezone_open( 'GMT' ); |
| 1599 | $datetime = date_create( $string, $timezone_object ); |
| 1600 | $timestamp = $datetime->getTimestamp(); |
| 1601 | } |
| 1602 | else { |
| 1603 | // PHP 4 |
| 1604 | 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); |
| 1605 | $timestamp = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]) + get_option('gmt_offset') * 3600; |
| 1606 | } |
| 1607 | return gmdate($format, $timestamp); |