开发者

Why Wordpress using two column to store post date

开发者 https://www.devze.com 2023-01-11 15:48 出处:网络
I see wordpress database on wp_posts table, there are 2 columns to store post date, post_date and post_date_gmt

I see wordpress database on wp_posts table, there are 2 columns to store post date, post_date and post_date_gmt

post_date_gmt store the post date in GMT time. And post_date store post date in user time who create the post. Am I right?

Is there any benefit to store both version of post date on database?

Is it faster to store both version of post date rather than calculate post_date_开发者_JAVA百科gmt with user timezone when user want to view post date based on his/her timezone

UPDATE: I Also ask on site point and get this answer

The one benefit it would provide is that if the person moves to a different timezone then their earlier posts still record what time it was where they were when they posted them and not what time it was where they are now (as would be all you could calculate using the GMT time and their current timezone).

http://www.sitepoint.com/forums/showthread.php?p=4671837


Not sure about the speed on the interpreter. One big reason they use GMT is actually that it makes the date-time more portable and not tied to a specific timezone and allows you to write code that is more general and internationalized. Why they save both is curious but the GMT format is definitely preferred for database storage.


Thats because some countries use Daylight Saving Time

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号