I have following list of date and values in list to convert from UTC to local time that is UTC + 1 during winter and UTC + 2 during summer.
Daylight saving time in Italy will begin at 2:00 am on Sunday, 31 March and will end at 3:00 am on Sunday, 27 October.
List with date and values
UTC_DATE Value 10/27/2019 0:00 10 10/27/2019 1:00 10 10/27/2019 2:00 10 10/27/2019 3:00 10 10/27/2019 4:00 10 10/27/2019 5:00 10 10/27/2019 6:00 10 10/27/2019 7:00 10 10/27/2019 8:00 10 10/27/2019 9:00 10 10/27/2019 10:00 10 10/27/2019 11:00 10 10/27/2019 12:00 10 10/27/2019 13:00 10 10/27/2019 14:00 10 10/27/2019 15:00 10 10/27/2019 16:00 10 10/27/2019 17:00 10 10/27/2019 18:00 10 10/27/2019 19:00 10 10/27/2019 20:00 10 10/27/2019 21:00 10 10/27/2019 22:00 10 10/27/2019 23:00 10
How do I convert the date in the list to local time to show the results like shown below on 27th of October
LOCAL_DATE Value 10/27/2019 0:00 10 10/27/2019 1:00 10 10/27/2019 2:00 10 10/27/2019 2:00 10 10/27/2019 3:00 10 10/27/2019 4:00 10 10/27/2019 5:00 10 10/27/2019 6:00 10 10/27/2019 7:00 10 10/27/2019 8:00 10 10/27/2019 9:00 10 10/27/2019 10:00 10 10/27/2019 11:00 10 ........ .... ........ .... 10/27/2019 23:00 10
And convert the date in the list to local time to show the results like below list on 31st of march
LOCAL_DATE Value 10/27/2019 0:00 10 10/27/2019 1:00 30 10/27/2019 3:00 10 10/27/2019 4:00 10 10/27/2019 5:00 10 10/27/2019 6:00 20 10/27/2019 7:00 10 10/27/2019 8:00 10 10/27/2019 9:00 10 10/27/2019 10:00 10 10/27/2019 11:00 10 ........ .... 10/27/2019 23:00 10
I am trying with below code, but not able to generate the missing hour 2 AM to 3 AM:
var timeZoneInfo = "Central Europe Standard Time";
var results = list.Select(o => new
{
LocalDate = TimeZoneInfo.ConvertTimeFromUtc(o.Date.Value, timeZoneInfo),
Value = o.Value
}).ToList();