tri_inn

tri_inn

  • NA
  • 1.2k
  • 223.5k

showing date and time to local date and time from UTC Date a

Nov 28 2015 12:57 PM

i have a page where people post various issue. i am saving date and time in sql server which is not UTC date and time. our web server is running in USA pc. so tell me how to save date and time in such a so when people will see their posted issue then they see the posted date and time as per their local time.

i have a plan i can save date and time in UTC format in sql server and fetch that date and time in UTC format and convert that utc date and time to local date and time by c# but the problem is our server side logic will run in USA pc. so if i convert to local date and time then it will be USA local date and time.

so tell me what logic i should use at mvc server side as a result from where the user will see my page they will see date and time as per their local time.

i can not work with user time zone because user time zone related info never pass to server side from client pc.

mostly how popular forum like http://forums.asp.net, stackoverflow.com etc do this ?

forums render date and time from server side not client side. so what logic they use.

please guide me in detail to achieve this task.

 One guy suggest me to store date and time in UTC format and show the date and time in UTC format too but one confusion occur in my mind that if i show the date and time in UTC format in the client then some confusion may occur. suppose my web server is in USA pc and one user from India post a question during day time but at the same time USA has night. so there could be date difference. suppose when date is 5/5/2015 then USA date could be 4/5/2015. so what UTC date will be flashed in page.
 
looking for suggestions from others. thanks

Answers (1)