0

I am currently saving the datetime.utcnow in the database on azure but im not sure how to display the correct time depending on the client.
Should I be using utc? Should I save the timezone so I can recalculate the time? Can I use the culture to change the time to the client time?

imGreg
  • 900
  • 9
  • 24
  • You can use one of these by setting the preference of user in his/her profile. Use that set preference for showing date. – Adil Feb 20 '15 at 04:23
  • @imGreg Please, refer to this: http://stackoverflow.com/questions/6525538/convert-utc-date-time-to-local-date-time-using-javascript – Augusto Barreto Feb 20 '15 at 06:28

1 Answers1

1

Your best option is to store the DateTime as UTC time and adjust it to local time (for the user's current location) each time you read it from the database.

You can use JavaScript to determine the timezone of the user:

new Date().gettimezoneOffset()

Utsav Dawn
  • 7,896
  • 2
  • 29
  • 44