In my code I have the following method:
public DateTime GetUtcStartOfDay(DateTime day) {
return TimeZone.AtStartOfDay(new NodaTime.LocalDate(day.Year, day.Month, day.Day)).ToDateTimeUtc();
}
for 2012/10/21 I would assume that it returns UTC 2012-10-21-03:00 as the time is advanced in Brazil 1 hour but nothing happened yet with respect to UTC.
Then for the following day 2012/10/22 I would assume to get UTC 2012-10-22-02:00 as the missing hour leads to the shorter day 21.
However for 2012/10/21 I get instead: 2012-10-21-02:59:59.999, which is 1 ms less then expected.
This millisecond is already missing iin the AtStartOfDay result, so I assume something is wrong here?
For the following day 22 I get the full hour as expected.
Same applies for all other years for the day where the 1 hour is advanced.
BTW I use BclDateTimeZone.
In my code I have the following method:
for 2012/10/21 I would assume that it returns UTC 2012-10-21-03:00 as the time is advanced in Brazil 1 hour but nothing happened yet with respect to UTC.
Then for the following day 2012/10/22 I would assume to get UTC 2012-10-22-02:00 as the missing hour leads to the shorter day 21.
However for 2012/10/21 I get instead: 2012-10-21-02:59:59.999, which is 1 ms less then expected.
This millisecond is already missing iin the AtStartOfDay result, so I assume something is wrong here?
For the following day 22 I get the full hour as expected.
Same applies for all other years for the day where the 1 hour is advanced.
BTW I use BclDateTimeZone.