On an application I am saving all dates into a database as UTC.
However, the users insert the dates in Lisbon timezone ...
I checked and Lisbon timezone is WEST in summer and WET the rest of the year.
WET = Western European Time
WEST = Western European Summer Time
I then tried the following:
DateTime now = DateTime.Now;
DateTime nowUtc = DateTime.UtcNow;
DateTime.SpecifyKind(now, DateTimeKind.Local);
DateTime testNowUtc = now.ToUniversalTime();
But testNowUtc becomes the same as now and not as nowUtc
How can I solve this?
** UPDATE **
I tried the following:
DateTime now = DateTime.Now;
DateTime nowUtc = DateTime.UtcNow;
String zone = TimeZoneInfo.Local.IsDaylightSavingTime(now) ? TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName;
DateTime testNowUtc = TimeZoneInfo.ConvertTimeToUtc(now, TimeZoneInfo.FindSystemTimeZoneById(zone));
But when I run it I get the error:
The time zone ID 'GMT Daylight Time' was not found on the local computer.
Am I missing something?