Many times, we store dates in our database by passing DateTime as a parameter value or by using GETDATE() in SQL Server. In both the cases, the time of the current machine is passed as the value. It is OK in case of Desktop applications however, when we move to Web applications, the current computer is the server where the website/app is hosted. This means if you’re in India and the website is hosted in a server in the US, the time stored in the database will be US time and not your local time. The correct way is to store the time in the local timezone. In this post we will see how to convert a DateTime object into specific TimeZone in C#.
To do this, we will use the FindSystemTimeZoneById() of TimeZoneInfo class. This function takes Id as a parameter to return the equivalent time in timezone passed. In the example below, we are taking the current system time and converting it into “Central Standard Time”.
- DateTime currentTime = TimeZoneInfo.ConvertTime(DateTime.Now, TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time"));
Let me know via comments if you are aware of about other ways to perform this action.

Ed EaglehousePosted Nov 11, 2021, 10:34 PM
Actually, the better way is to store the time as UTC, which is unambiguous. The best place to perform time zone conversions is in the UI. By always dealing with UTC times in calculations, you avoid some detrimental effects from the adjustments that have to be done to get local times. If you ever deal with more than a single time zone, handling instants in time that don't change saves many headaches, except for the fact that .NET technologies don't always preserve the "Kind" of a DateTime.
ali tuncerPosted Apr 9, 2016, 11:53 PM
Hi Nitesh, Is there a way to get user's time zone?
Rajeev PunhaniPosted Apr 1, 2016, 8:14 AM
Nice.