Click here to Skip to main content
15,893,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have purchase the domain from Outside India where the date is not matching to indian date.

So Please help me how i will set my date.

Thanks.
Posted

1 solution

This is not a problem at all, because the server-local time zone is known from the OS. See the class System.TimeZoneInfo, http://msdn.microsoft.com/en-us/library/system.timezoneinfo.aspx[^].

On the client side, time zone is known from JavaScript API, see http://www.w3schools.com/jsref/jsref_gettimezoneoffset.asp[^].

I would prefer another approach: do all your calculations in all the application using only UTC time, which by definition is the same for any place on the Globe. Use System.DateTime.UtcNow. Of course, for the users it's convenient to use their local time. Use it only at the moment when you need to show time in HTML; convert UTC time to local time using JavaScript as I mentioned above.

That's it.

—SA
 
Share this answer
 
Comments
Monjurul Habib 3-Dec-11 1:58am    
nice detail with links, my 5!
Sergey Alexandrovich Kryukov 3-Dec-11 21:56pm    
Thank you, Monjurul.
--SA
thatraja 3-Dec-11 14:42pm    
5!
Sergey Alexandrovich Kryukov 3-Dec-11 21:56pm    
Thank you, Raja.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900