0

We have a web and mobile application where a user in one time zone provides an online service. Now he has his schedule which we are storing in UTC.

My problem is:

  1. How to show the schedule for his availability based on the user from around the globe. For eg: If the User providing the Service is from India at time 6-8 AM (UTC+5:30) on a particular day then how to show the time in other zones? Suppose in USA where the time zone difference can be UTC-10:00 or UTC-8:00. In this case the day will be previous to one he is providing service on. Or The time zone can be Australia or New Zealand where it might go to next day.

  2. What will be best way for storing the user selected time? Whether it should be in UTC or in his local time? Should we capture the user time zone at the time of registration and then convert the data based on that ?

  3. What if the same user is using the service from outside the place where he registered from? How should we show the time on his dashboard for the service? Based on the time zone captured at the time of registration? or something else?

  4. How to handle day light savings ?

nkhlgpt
  • 73
  • 1
  • 7
  • The only sane way to handle this IMO is to store timestamps in MySQL in UTC. It is then up to the user/consumer to convert to his own timezone. In some cases, MySQL will automatically convert to UTC. – Tim Biegeleisen Oct 20 '17 at 07:18
  • @TimBiegeleisen we are storing the data in time stamp but we are handling the conversion at the back end currently not the front end. We are just a bit confused when the conversion gives a time value which is of previous day. What should be done for that? Whats the best approach to show such data? – nkhlgpt Oct 20 '17 at 07:40
  • Hello.This topic has been discussed many times before, and your questions are too broad as currently stated. Please read through the tz/dst best practices community wiki linked above. If you have more specific questions, first search to see if they've already been asked. If after doing so you still have a specific question, then ask that specific question. Thanks. – Matt Johnson-Pint Oct 20 '17 at 16:49
  • Also recognize that in your third question above, you seem to be asking us for requirements. We cannot tell you what to do in your own application. You will have to decide those things, or work with your team/customer/stakeholder/manager to decide what behavior you would like to implement. – Matt Johnson-Pint Oct 20 '17 at 16:52

0 Answers0