SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    May 2009
    Location
    Bali
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    why wordpress using two column to store post date

    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_gmt with user timezone when user want to view post date based on his/her timezone

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,598
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    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).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    May 2009
    Location
    Bali
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the response, I just curious if there any special case on wordpress so they use 2 column to store post date. maybe there are really no effect on performance

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2010
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Impact on performance is so minimal that it shouldn't even be considered.
    Yes, it would be faster if you removed one of the columns since there would be 1 operation less to do with each entry, but really - it's not an area where anyone should consider for optimizing since it's not the bottleneck.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •