473,480 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Utcnow IsDayLightSaving() problem

Hello there,

I'm having a problem with Utcnow property. I'm checking the Utcnow for
IsDayLightSaving() if true or false. I'm setting the timezone to GMT
time London etc and during summer when daylight saving is applied hence
GMT Daylight time.

However the System.DateTime.Utcnow.IsDayLightSaving() always returns
false even when it is on GMT Daylight time. Whats this.. what I'm
missing?

Thanks for any insights

Jan 16 '06 #1
6 7155
Varangian wrote:
I'm having a problem with Utcnow property. I'm checking the Utcnow for
IsDayLightSaving() if true or false. I'm setting the timezone to GMT
time London etc and during summer when daylight saving is applied hence
GMT Daylight time.

However the System.DateTime.Utcnow.IsDayLightSaving() always returns
false even when it is on GMT Daylight time. Whats this.. what I'm
missing?


A UTC date-time surely *never* has daylight savings time applied to it,
by definition. That's what I'd have expected.

Jon

Jan 16 '06 #2
The strange thing is when I apply to GMT time zone on my computer and
set the time a minute before daylight savings apply and wait until the
minute passes say for example for this year it is on 01:00.... I set it
to 00:59 and wait until it applies. I see that the time would be 02:00.
So there seems to be daylight saving in the GMT Time zone. And in fact
in my code I check by System.DateTime.Now.IsDayLightSaving() and
returns true.

strange but true. Thanks Jon Skeet

Jan 16 '06 #3
If I am reading the documentation correctly, the IsDaylightSavings() ALWAYS
returns false if the 'Kind' property of the DateTime is Utc. Thus I would
think that DateTime.UtcNow.IsDaylightSavings() always returns false,
whereas DateTime.Now.IsDaylightSavings() might return true if it truly is
Daylight Savings. The 'Kind' property is new to .NET 2.0, so if you are
using 1.1 you won't see it, but it still might be there. Try using
DateTime.Now instead.

Also, Are you actually setting the time on your computer, or just setting
the timezone? I would think that your computer time must be set to a
date/time during which it is ACTUALLY Daylight Savings. We are currently
on Standard Time (DST runs from early April to late October.)

-mdb

"Varangian" <of****@gmail.com> wrote in news:1137422513.885462.241620
@g47g2000cwa.googlegroups.com:
Hello there,

I'm having a problem with Utcnow property. I'm checking the Utcnow for
IsDayLightSaving() if true or false. I'm setting the timezone to GMT
time London etc and during summer when daylight saving is applied hence
GMT Daylight time.

However the System.DateTime.Utcnow.IsDayLightSaving() always returns
false even when it is on GMT Daylight time. Whats this.. what I'm
missing?

Thanks for any insights


Jan 16 '06 #4
Thats what I'm doing, I'm actually setting on the windows datetime on
the taskbar to 26/03/2006 01:59. I thought that Utcnow is the same as
GMT Time set on the your computer which it seems is not.

Jan 16 '06 #5
Thats what I'm doing, I'm actually setting on the windows datetime on
the taskbar to 26/03/2006 01:59. I thought that Utcnow is the same as
GMT Time set on the your computer which it seems is not.

Thanks Michael bray

Jan 16 '06 #6
Varangian wrote:
The strange thing is when I apply to GMT time zone on my computer and
set the time a minute before daylight savings apply and wait until the
minute passes say for example for this year it is on 01:00.... I set it
to 00:59 and wait until it applies. I see that the time would be 02:00.
So there seems to be daylight saving in the GMT Time zone. And in fact
in my code I check by System.DateTime.Now.IsDayLightSaving() and
returns true.


Well, I'm in the UK and always pick GMT as my time zone - but
definitely apply daylight savings. In the summer we're in BST (British
Summer Time). I suspect there are two sort of parallel considerations
for GMT going on, effectively. However, UTC is a "constant" - it's GMT
without daylight savings, effectively. (Actually, I've a suspicion
there are some subtle differences in terms of leap seconds etc, but
nothing to worry about.)

Jon

Jan 16 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1973
by: Steve Erickson | last post by:
I have a logger class that uses the Python logging module. When I call it within a program using the unittest module, I get one line in the log file for the first test, two identical ones for the...
11
3727
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
9
2213
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
117
7095
by: Peter Olcott | last post by:
www.halting-problem.com
0
3607
by: James Griffiths | last post by:
Here is a report I've written about a printing problem that is being experienced by a particular company for whom I had developed a A97 system. After upgrading to Win XP and AXP, some printing...
18
6136
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
0
1617
by: Elizabeth Harmon | last post by:
hi All I know this has been asked propably a million times, i hope you'll indulfe one more question. I am Coding on a Windows 2000 VS.Net 2003 1.1 Box. I need to get Zulu Date/UTC/GMT which...
1
1023
by: T-u-N-i-X | last post by:
Hey There, I'm a django developer and working on a project right now.. Last week I just discovered a new problem in Python.. Here's what I do.. (tunix@penguix ~)$ date Sal May 20 01:00:10...
36
4528
by: Nick | last post by:
Hi there I'm trying to use the IsDaylightSavingTime property of the datetime object. The PC I am using is in GMT, DateTime.Now.IsDaylightSavingTime() returns true...
0
6904
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7076
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6732
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6886
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4768
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
2990
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2976
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1294
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
174
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.