I'm trying to get local Moscow time in my .NET application.
Here is how far I went:
private static Dictionary<TimeZoneEnum, string> timeZoneDict = new Dictionary<TimeZoneEnum, string>()
{
{TimeZoneEnum.RussiaStandardTime, "Russian Standard Time"}
};
public static DateTime GetDateTimeNowForTimeZone(TimeZoneEnum timezone)
{
DateTime result = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(timeZoneDict[timezone]));
return result;
}
Method GetDateTimeNowForTimeZone gives me GMT+3 time but now in russia there is GMT+4 time. Is there anyu way to get robust solution for this issue in .net framework ?