Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

DateTime.Now.IsDaylightSavingTime() return wrong value

$
0
0

I'm running a application on Windows Server 2003 when i got a TimeZone problems.

I did the following aspx page to confirm the problem:

<%@ Import Namespace="System.Globalization.CultureInfo" %><%
	System.Globalization.CultureInfo.CurrentCulture.ClearCachedData()
%><%= DateTime.UtcNow %><br><%= DateTime.Now %><br><%= TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now) %><br><%= DateTime.Now.IsDaylightSavingTime() %><br><%= TimeZoneInfo.Local.IsDaylightSavingTime(DateTime.Now) %><br><%= TimeZone.CurrentTimeZone.StandardName %><br><%= TimeZone.CurrentTimeZone.DaylightName %><br><%= TimeZoneInfo.Local.Id %>

This gives me the following result:

10/01/2018 14:10:35 
10/01/2018 11:10:35 
-02:00:00 
False 
False 
E. South America Standard Time 
E. South America Daylight Time 
E. South America Standard Time


Why

DateTime.Now.IsDaylightSavingTime()

returns False to my timezone, while it should return True?

Also, the DateTime.Now is returning -03:00:00 offset (no daylight saving) while it should return -02:00:00 (daylight saving)

Running the same page on another server (also Windows Serever 2003) everithing is ok.

Any ideas on how to fix this issue?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>