How to change default timezone c#

Total Post:154

C#  .NET  Time 
 1976  View(s)
Rate this:

How can I change default timezone on my MVC(c#) web application? Server located in USA, clients connecting from Turkey... I'm looking for a global solution for it, as global.asax or webcofig...

  1. Post:159

    Re: How to change default timezone c#

    DateTime utcTime = DateTime.UtcNow;
            string zoneID = CurrentUserSession.TimeZoneID // Here you get the current login user session and their TimeZone which you configured in database at the time of user creation. or if you want to get client pc time zone then you have to use javascript and get client pc Timezone
            TimeZoneInfo myZone = TimeZoneInfo.FindSystemTimeZoneById(zoneID);
            DateTime custDateTime = TimeZoneInfo.ConvertTimeFromUtc(utcTime, myZone);

      Modified On Mar-10-2015 06:44:21 AM