I store all datetime values as unix timestamp. Registered users can set personal GMT locale in their profile. What should I do to display all datetime on website in user’s GMT locale?
Thank you
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
There’s no such thing as “user’s GMT locale”. You must be referring to the user’s timezone.
You can convert unix timestamps to dates in the user timezone this way:
If you only have a GMT offset, you can use:
Note, however, that if you use GMT offsets, you will have to change them when the users enter or leave daylight saving time.