Translate current_time
Used date_i18n instead of current_time. For example: echo date_i18n( ‘Y. F j.’, strtotime( get_the_time( “Y-m-d” ) ) );
Used date_i18n instead of current_time. For example: echo date_i18n( ‘Y. F j.’, strtotime( get_the_time( “Y-m-d” ) ) );
Make WordPress use timezone for email Date header
Convert CST published date time to MST timezone
your post is very old, but in case someone gets the same issue. Even if your server is set to date_default_timezone_set(‘America/New_york’); When WordPress runs, it rewrite the config to date_default_timezone_set(‘UTC’) to store datetime in UTC, which is the Universal Time without offset. Usually, when I compare a date to now, I use the variable $_SERVER[‘REQUEST_TIME’]. … Read more
I have changed the time zone of my blog and all times of my posts are wrong. How can I fix it?
current_time() supports GMT as the second parameter. See: https://codex.wordpress.org/current_time If no second parameter is passed it should return the timezone set for your site.
For starters try Core Control plugin to see if scheduled tasks are accurately assigned. Scheduled posts will show up as publish_future_post > check_and_publish_future_post() with post’s ID as argument.
I use this: $mytheme_timezone = get_option(‘timezone_string’); date_default_timezone_set($mytheme_timezone); in my themes functions.php. For me this has worked without any warnings. I’ve also tested whether my script is in different timezone than php.ini: if (strcmp($mytheme_timezone, ini_get(‘date.timezone’))){ echo ‘Script timezone differs from ini-set timezone.’; } else { echo ‘Script timezone and ini-set timezone match.’; } Please improve this … Read more
OK, I found the answer myself. Turns out that in WordPress the UTC time is hardcoded and thus using PHP’s date() will always return UTC. Instead you should use WP’s function current_time(). Here are more details
If it is the example in the timezone settings you’re referring to here: Then this is expected behaviour, and is correct by definition according to ISO standards, because this is not the time, it’s a timestamp. This way there is no ambiguity about the time being referenced, and it’s the only place in WordPress where … Read more