Timezone seems to be off
-
It seems there is an issue with the timezone. The WordPress blog I am importing to has its timezone set to Los Angeles time. But all imported posts timestamps seem to be British times.
For example: Both the Blogger blog and WordPress blog involved in the migration are set to Los Angeles time (UTC-7 during summer time). If a post that was posted at 8:00am Los Angeles time on Blogger get migrated, it ends up in WordPress with a timestamp of 5:00pm (or 17:00), which is the British time (UTC+1 during summer time), interpreted as Los Angeles time
This seems to be related to this bit of code when the importer creates the WordPress post:
$insert_post = array( 'post_type' => 'post', 'post_date' => $item->published, 'post_content' => '', 'post_title' => $item->title, 'post_status' => 'publish', 'ping_status' => 'closed', 'post_name' => $item->slug, 'tags_input' => property_exists($item, 'labels') ? $item->labels : '', );
The
post_date
property requires a timestamp in the timezone of the WordPress blog, but the$item->published
property seems to always be British time, causing the time mistmatch in the blog.If the
$item->published
timestamp retrieved from the api can be guaranteed to be UTC/GMT instead it could be easily solved using the GMT property'post_date_gmt' => $item->published
. Then WordPress would handle the conversion for the local blog timezone based timestamps.I don’t know how this could be easily solved for British time though (since that only matches up with UTC/GMT during winter time).
- The topic ‘Timezone seems to be off’ is closed to new replies.