DateTime

Setting the time zone in C#.NET

April 3, 2014
.NET, C#, database, DateTime, Timezone, UTC

DateTimes in .NET are always in one of two timezones - UTC or local time. This advice will make your life easier: Always store DateTimes in UTC. Unfortunately sometimes we need to deal with timezones stored in a timezone other than UTC. Maybe we’ve inherited a system or we’re integrating with another system which doesn’t save as UTC. If your web server and database server are both in the same timezone and the DateTime is stored in the server’s local timezone then everything is still OK. ...