Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to render a user the local-time using a UTC Time (asp.net & ajax)

I've an issue while my data persisted as utc date-time and I want my users see the right time (thier) local time.

I can do this using javascript that sends the local time from the client machine to server, but this will cause me the first time the page will be seen it will be written using the UTC-Time.

do you have more ways? thanks.

like image 633
rabashani Avatar asked Nov 15 '22 15:11

rabashani


1 Answers

Woot does this - Every time they render a forum post, they include a <span class="time">(The time in Central time, their home time)</span> and then have a javascript that enumerates all spans of class "time" and does a simple datetime conversion to convert it to the local time; if you don't have JS, you just get Central Time Zone times on forum posts.

like image 64
Aric TenEyck Avatar answered Dec 02 '22 20:12

Aric TenEyck