0

I am using angularjs on the frontend and a mysql DB. I am using ui.bootstrap timepicker to select a time. The issue that I am having is that the user will pick a time and it will look like this: Thu Apr 27 2017 09:00:00 GMT-0600 (Mountain Daylight Time).

The time is saved just fine to the DB looking like this: 2017-04-27 09:00:00.000. When the date gets retrieved from the DB it is then changed to look like this: Thu Apr 27 2017 15:00:00 GMT-0600 (Mountain Daylight Time).

I can see what is going on; it is adding the timezone to the date. What I don't understand is why it is doing this and how to fix it, so it shows the time that the user put in.

Please help and give direction.

maus
  • 80
  • 7

1 Answers1

0

Just convert all the time to utc before saving to db. And while retrieving the time you should convert it to your desired timezone.

This will help you to get the correct result.

Nair Athul
  • 823
  • 9
  • 21