Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6091917
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:22:59+00:00 2026-05-23T12:22:59+00:00

I’m developing a web application that involves the use of timestamps. I would like

  • 0

I’m developing a web application that involves the use of timestamps. I would like the timestamps to display in the user’s time zone with as little configuration as possible. Facebook and Google Calendar both update their displayed time automatically when logged into from different time zones.

What is the most effective method you’ve used to deal with time zones in your web apps? If at all possible, I would like to require no additional input from the user.

Here’s what I’m thinking so far:

  1. Store all timestamps in the database in UTC
  2. Keep a database table that correlates time zones to UTC offsets, and whether daylight savings time is observed in that time zone
  3. Given client information (IP address?), find the user’s current time zone. This information can be cached in a session variable to prevent repeated reads to the table.
  4. Whenever a timestamp from the database is to be displayed, convert it using the UTC offset

I find it hard to believe that there’s nothing out there already that does this. If you have any suggestions, I’d appreciate it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:22:59+00:00Added an answer on May 23, 2026 at 12:22 pm

    I’d propose another solution:

    1. Store all the dates in mysql timestamp column type
    2. Right after connect to mysql – specify current user’s timezone with SET time_zone='<tz>' where <tz> can be either +01:00 offset or timezone name Asia/Vladivostok (for the latter special timezones db should be imported by DBA)

    The benefit of using timestamp is that it automatically converts the date to and from UTC, according to the time_zone you’ve specified in the current connection.

    More details about timestamp: http://dev.mysql.com/doc/refman/5.1/en/timestamp.html

    About retrieving current user’s timezone (even though there are a lot of answers here on SO about this topic, let’s do that once again):

    1. As long as there is a TZ value in cookies (look at step 4) – use it.
    2. For registered/authenticated users – you can ask to specify their timezone and store it permanently in DB.
    3. For guests you can retrieve the timezone from javascript (Date.getTimezoneOffset()) and send it with ajax
    4. If it is the first request/nothing passed from ajax – guess it by IP
    5. For each step (1-3) – save timezone to a cookie.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.