Localization of TimeZone [Resolved]

Posted by Dev080692 under ASP.NET MVC on 12/24/2015 | Points: 10 | Views : 527 | Status : [Member] | Replies : 2
How to set time of client timezone in asp.net app. I want to set or store time of client timezone on asp.net mvc app.




Responses

Posted by: Rajnilari2015 on: 12/24/2015 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
Try

string zoneID = "India Standard Time";
TimeZoneInfo
.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(zoneID))
.ToString();


Hope this helps

--
Thanks & Regards,
RNA Team

Dev080692, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 12/24/2015 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi,

The client could by anyone from the world. You have to convert your local time to UTC based on which timezone is resides on the server.

Example-

var list = from tz in TimeZoneInfo.GetSystemTimeZones()
select new SelectListItem { Value = tz.Id, Text = tz.DisplayName };


Refer below link-
http://stackoverflow.com/questions/7577389/how-to-elegantly-deal-with-timezones

Jitendra Kumar
If my post helps you, plz mark as an answer.

Dev080692, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response