Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server

How to convert UTC time to Local Time

3.40/5 (4 votes)
2 Jan 2012CPOL 15.2K  
I wanted to point out that while I agree with the general approach (storing DateTime in UTC and converting into local time for display as well as accepting input in local time), it's not always what the requirements call for. If you're creating a meeting calendar, then of course it's perfect,...
I wanted to point out that while I agree with the general approach (storing DateTime in UTC and converting into local time for display as well as accepting input in local time), it's not always what the requirements call for. If you're creating a meeting calendar, then of course it's perfect, or in fact anything where the time displayed need to be universal... but there are applications where the underlying intent is to different. For example, the office closes early, at 4:00 on new years eve this year. You don't want your folks who work in the USA leaving work at 16:00 Ukrainian time :).

I guess what I mean to get across is that DateTime work is tricky enough even when the intent is clear, but the intent is not always the same. So it's good to make sure you're solving the right problem.

License

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