Hey all,
I am writing a web app and I would like to display timestamps on the page in the user's localtime. There seems to be several ways to do this but it is not obvious what is a good way.
- Use geolocation from the IP address to get the timezone - This seems like a lot of overhead.
- Use javascript to finally render the datetime on the page - This seems like a lot of complex client side javascript.
- Use javascript to get the timezone and locale from the user's preferences and save it in a cookie. The server can then use this to format the date. Server side code is nice, but there don't seem to be many good ways to get this for the first page load.
- Any options for http request headers? Which ones? How reliable across browsers are they?
Any advice on good ways to implement this?