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));
-
- 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);
-
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???