Web application date time localization best practice at 201x

Posted by Hieu Lam on Stack Overflow See other posts from Stack Overflow or by Hieu Lam
Published on 2011-01-18T03:46:51Z Indexed on 2011/01/18 3:53 UTC
Read the original article Hit count: 327

Filed under:

Hi all, I have worked for various web projects but correct date time localization have not been done and considered throroughly so I want to ask this very typical problem here and I want to hear comments from expert in this problem

  1. What is the correct strategy for storing a date/time value from client from server

As I understand, because of locale and timezone so we have to do the conversion, I have heard about GMT or UTC time and after do some search it seems that UTC is more accurate ? so we will convert from client time -> UTC+0 when saving and when we read the value from server to client, we convert from server time back to client time again ? However, I see in some website, at the bottom have the sentence "All times are in UTC", "All times are in GMT" and also "All times are in your local time". So maybe not all the sites do the convertion back and forth ? And in that case the user has to manually do the date/time conversion ?

  1. How to display the date/time convenient to user based on his locale and region

How to provide personalization on date/time value ? I had one time depends on vbscript to do the display and the format is read from windows regional and format settings automatically. But without vbscript how can we determine a date/time pattern for a user of a specific locale. Do we have to store a mapping between a locale and pattern somewhere and do the conversion at the server side ?

  1. Although date/time conversion is needed in most case, there's situation where only date matter for example if my birthday is 2 Feb 1980, it should be the same for all locale and no conversion should be done. How can we address this issue.

© Stack Overflow or respective owner

Related posts about localization