﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc	focuses	prnumber
48384	get_post_time returns wrong value after timezone switch	david.binda	SergeyBiryukov	"When testing the r46154 , I've run into a regression, when the returned time from `get_post_time` is incorrect after a timezone setting swith.

I know that the timezone is not expected to be changed often, but it still may happen.

In case a post is created with a timezone set, for instance, to UTC+0, and then later changed to a different one, for instance UTC+2, the `get_post_time` function with the `$gmt` param set to `true`, i.e. expecting UTC+0, would return an original post time with the new offset added/substracted (expected behaviour would be the same time, as the post was created under the UTC+0 timezone).

The issue is visible on post listing in wp-admin/edit.php, where post created during the UTC+0 timezone being set, are marked as 2 hours ago, after changing the timezone to UTC+2.

I've created a phpunit test demostrating the issue. The test is passing in 5.2.4, and even on 5.3 RC1 after reverting the r46154, but not when r46154 is being applied.

Checking the updated code of `get_post_time`, `get_post_modified_time` and of a newly added `get_post_datetime`, as well as `get_post_timestamp`, it feels like those functions should default to work with the gmt version of the date (stored in post_date_gmt/post_modified_gmt) and should recalculate the GMT datetime to currently set timezone, rather than changing the `post_date` to UTC, as the code does not know, what timezone was used for storing the data."	defect (bug)	closed	normal	5.3	Date/Time	trunk	normal	fixed	has-patch has-unit-tests			
