Hello,
APS uses the current local time of the server and the Timezone set in WordPress->Settings->General.
When you enable APS what does it display at the top? It should be something like
Current Status: Enabled
Current server time:2014-12-22 09:29:28 America/New_York
Next auto post check:2014-12-22 10:28:50 America/New_York
Hi, Thanks for your reply.
There are 3 places setup timezone: 1)server, 2)wp_settings.php, 3)WordPress->Settings->General.
When I change number 2 (via my theme function, of course. It’s not a good idea to touch the WP core, right?) to my timezone by
date_default_timezone_set( 'America/Los_Angeles' );
Auto Post Scheduler will display the weird time, 8 hour behind my timezone.
I tested this all the day to make sure. see table below(yes=correct, no=wrong):
Server: LA LA UTC UTC
WP_settings: LA UTC LA UTC
WP option: LA LA LA LA
APS: NO YES NO YES
Why would you need to change wp_settings.php? Sounds like it is converting the timezone offset twice. Try it without.
APS gets the local time via the WordPress function
current_time(“timestamp”)
Yes it looks like double dipping when you call date_default_timezone_set() in your code.
Added this to functions.php to test
function heartbeat_debug() {
error_log('Local Time: ' . date('Y-m-d H:i:s',current_time("timestamp")) . " " . get_option('timezone_string'));
error_log('GMT Time: ' . date('Y-m-d H:i:s',current_time("timestamp", 1)) . " GMT" );
date_default_timezone_set( 'America/New_York' );
error_log('calling date_default_timezone_set');
error_log('Local Time: ' . date('Y-m-d H:i:s',current_time("timestamp")) . " " . get_option('timezone_string'));
error_log('GMT Time: ' . date('Y-m-d H:i:s',current_time("timestamp", 1)) . " GMT" );
}
add_action('wp_head', 'heartbeat_debug');
Outputs:
[23-Dec-2014 15:16:50 UTC] Local Time: 2014-12-23 10:16:50 America/New_York
[23-Dec-2014 15:16:50 UTC] GMT Time: 2014-12-23 15:16:50 GMT
[23-Dec-2014 10:16:50 America/New_York] calling date_default_timezone_set
[23-Dec-2014 10:16:50 America/New_York] Local Time: 2014-12-23 05:16:50 America/New_York
[23-Dec-2014 10:16:50 America/New_York] GMT Time: 2014-12-23 10:16:50 GMT
>Why would you need to change wp_settings.php?
Same timezone as my local computer.
>Sounds like it is converting the timezone offset twice.
Exactly.
That’s what WordPress->Settings->General->Timezone is for.