Last active
January 7, 2019 20:00
-
-
Save NickGreen/0e294af99eaf2ec4954813276f3dc1cf to your computer and use it in GitHub Desktop.
Output various times
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action('wp_footer', 'test_func'); | |
| function test_func() { | |
| error_log("WORDPRESS OUTPUT_______"); | |
| error_log( "get_option('gmt_offset') returns: " . get_option('gmt_offset') ); | |
| error_log( "get_option('timezone_string') returns: " . get_option('timezone_string') ); | |
| $blogtime = current_time( 'mysql' ); | |
| list( $today_year, $today_month, $today_day, $hour, $minute, $second ) = preg_split( '([^0-9])', $blogtime ); | |
| error_log( "current_time( 'mysql' ) returns local site time: " . current_time( 'mysql' ) ); | |
| error_log( "current_time( 'mysql', 1 ) returns GMT: " . current_time( 'mysql', 1 ) ); | |
| error_log( "current_time( 'timestamp' ) returns local site time: " . date( 'Y-m-d H:i:s', current_time( 'timestamp', 0 ) ) ); | |
| error_log( "current_time( 'timestamp', 1 ) returns GMT: " . date( 'Y-m-d H:i:s', current_time( 'timestamp', 1 ) ) ); | |
| error_log( "SERVER OUTPUT_______"); | |
| if (date_default_timezone_get()) { | |
| error_log( "date_default_timezone_set: " . date_default_timezone_get() ); | |
| } | |
| if (ini_get('date.timezone')) { | |
| error_log( "date.timezone: " . ini_get('date.timezone') ); | |
| } | |
| error_log( "gmdate('Y-m-d H:i:s') returns GMT: " . gmdate("Y-m-d H:i:s") ); | |
| error_log( "date('Y-m-d H:i:s') returns local server time: " . date("Y-m-d H:i:s") ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment