GMT time matching in c# mvc not working.
Problems having fetch of time difference is not correct.
Here is the code i am tred but not working:
- DateTime newDateTime = Convert.ToDateTime(DateNw).Add(TimeSpan.Parse(Time));
- ////New Zealand
- string nzTimeZoneKey = Country + " Standard Time";
- string date = newDateTime.ToUniversalTime().ToString("u");
- DateTime localDateTime = DateTime.Parse(date);
- DateTime utcDateTime = localDateTime.ToUniversalTime();
- TimeZoneInfo nzTimeZone = TimeZoneInfo.FindSystemTimeZoneById(nzTimeZoneKey);
- DateTime nzDateTime = TimeZoneInfo.ConvertTimeFromUtc(utcDateTime, nzTimeZone);
- //return nzDateTime;
The above code working for India and afganistan working very well but if i change the country between india and fiji it is not working.
I want GMT time matching for all the country where i can differnciate two country time. Any suggestion???
Chetan RanpariyaPosted Jan 19, 2017, 7:20 PM
Mangesh GPosted Jan 19, 2017, 12:33 PM