473,569 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Daylight time wrong UTC time

I created a UTC clock using this:
UTCTime = MyTime.ToUniver salTime()
Now that we've turned the clocks ahead 1 hour for daylight savings time, the
clock is reporting the wrong UTC time. It is reporting UTC + 1 hour.
Is this a bug or is there a way I can querey for daylight time and make the
adjustment in my application?

Thanks.
Nov 21 '05 #1
7 4071
This came up a few weeks ago in this newsgroup. Basically, MS Explorer shows
the correct time whereas the applications show MS Explorer time + 1 hour.
So, I guess it is an error

Crouchie1998
BA (HONS) MCP MCSE.
Nov 21 '05 #2
I think it is a bit imprudent to call it an error.

I, for example have never seen the bahaviour that has been described
regardless if the macine is in daylight saving time or not and also
regardless of whether or not daylight saving time has just cut in or out as
the case may be.

I think the appropriate course of action is for the original poster to
identify the specific condition that is causing the behaviour in the
configuration of the machine in question.
"Crouchie19 98" <cr**********@s pamcop.net> wrote in message
news:Oj******** ******@tk2msftn gp13.phx.gbl...
This came up a few weeks ago in this newsgroup. Basically, MS Explorer
shows
the correct time whereas the applications show MS Explorer time + 1 hour.
So, I guess it is an error

Crouchie1998
BA (HONS) MCP MCSE.

Nov 21 '05 #3
Brett,

This gives me the correct UTC time (In the EU is summertime, as it is named
here started, with Easter).

MessageBox.Show (Now.ToUniversa lTime.ToString)
I hope this helps,

Cor
Nov 21 '05 #4
Here's whole little thing for clarification.. .

Private Sub Timer1_Elapsed( ByVal sender As System.Object, ByVal e As
System.Timers.E lapsedEventArgs ) Handles Timer1.Elapsed
MyTime = TimeOfDay
UTCTime = MyTime.ToUniver salTime()
TextBox1.Text() = UTCTime

End Sub

-Brett

"Stephany Young" wrote:
I think it is a bit imprudent to call it an error.

I, for example have never seen the bahaviour that has been described
regardless if the macine is in daylight saving time or not and also
regardless of whether or not daylight saving time has just cut in or out as
the case may be.

I think the appropriate course of action is for the original poster to
identify the specific condition that is causing the behaviour in the
configuration of the machine in question.
"Crouchie19 98" <cr**********@s pamcop.net> wrote in message
news:Oj******** ******@tk2msftn gp13.phx.gbl...
This came up a few weeks ago in this newsgroup. Basically, MS Explorer
shows
the correct time whereas the applications show MS Explorer time + 1 hour.
So, I guess it is an error

Crouchie1998
BA (HONS) MCP MCSE.


Nov 21 '05 #5
I changed my querey of the current time from:
TimeOfDay() to Now()
This fixes the problem

Brett

"Brett Edman" wrote:
I created a UTC clock using this:
UTCTime = MyTime.ToUniver salTime()
Now that we've turned the clocks ahead 1 hour for daylight savings time, the
clock is reporting the wrong UTC time. It is reporting UTC + 1 hour.
Is this a bug or is there a way I can querey for daylight time and make the
adjustment in my application?

Thanks.

Nov 21 '05 #6
Well, that puts things in perspective.

Throw a couple of telltales in and you will see what is happening.

MyTime = TimeOfDay
Console.Writeli ne(MyTime.ToStr ing())
UTCTime = MyTime.ToUniver salTime()
Console.Writeli ne(UTCTime.ToSt ring())
TextBox1.Text() = UTCTime

Note what date part of the results shows.

From the documentation on the TimeOfDay property:

<quote>
Returns or sets a Date value containing the current time of day according to
your system.
</quote>

<furtherquote >
The Date data type includes date components. When returning the system time,
TimeOfDay sets these all to 1, so the returned value represents the first
day of the year 1.
</furtherquote>

When I execute you EXACT code I get 12:00:00 AM and the telltale shows
1/01/0001 12:00:00 AM. This timezone during daylight saving is UTC+13 hours
and the current time is about 10:30 AM. Subtracting 13 hours from 1/01/0001
10:30:00 AM would give 31/12/0000 9:30:00 PM but that is prior to the lowest
value allowed for a date and so it uses the lowest allowed as the result.

When I execute the following:

Dim MyTime As Date = CDate("01/01/0001 18:30:00")
Console.WriteLi ne(MyTime.ToStr ing())
Dim UTCTime As DateTime = MyTime.ToUniver salTime()
Console.WriteLi ne(UTCTime.ToSt ring())

I get:

1/01/0001 6:30:00 PM
1/01/0001 5:30:00 AM

Which is what I expect during daylight saving (UTC+13 hours). 1 January
falls within the daylight saving period down this end of the world.

When I modify the code to:

Dim MyTime As DateTime = CDate("30/06/0001 18:30:00")

I get:

30/06/0001 6:30:00 PM
30/06/0001 6:30:00 AM

Which, again, is what I expect during standard time (UTC+11 hours).

When I execute the first block of code (above) I notice a significant delay
betwen the first and second telltales being displayed. The delay is of about
the length that I observe when an exception is about to be thrown. I suspect
that some extra maths is going on here to ensure that the result is not
prior to the lowest value allowed for a date.

Given these findings, in my opinion, if the result of a date calculation
gives a result prior to the lowest value allowed for a date than a suitable
exception should be thrown rather than returning an erroneous value.

HOWEVER!

If you use:

Dim MyTime As DateTime = DateTime.Now
Console.Writeli ne(MyTime.ToStr ing())
Dim UTCTime As DateTime = MyTime.ToUniver salTime()
Console.Writeli ne(UTCTime.ToSt ring())
TextBox1.Text() = UTCTime.ToLongT ineString()

You will always get the correct result in relation to your current timezone
(regardless of the daylight saving status) and your current culture.

I must say that it never would have occurred to me to try and convert a time
part to UTC because UTC is as much to do with the date part as it is the
time part. Maybe it's because, down this this end of the world, we spend at
least half our time having a different date than UTC does and perhaps that
makes us more aware of the need to make sure we use the correct techniques
when converting to and from UTC. In Western Europe, for example the date is
only different for, at most, 2 hours per day and that is when most sane
people are asleep and maybe the difference is not noticed anywhere as much.

I hope I have managed to make this a clear as mud and I'll see you on our
next 'date' :)
"Brett Edman" <Br********@dis cussions.micros oft.com> wrote in message
news:00******** *************** ***********@mic rosoft.com...
Here's whole little thing for clarification.. .

Private Sub Timer1_Elapsed( ByVal sender As System.Object, ByVal e As
System.Timers.E lapsedEventArgs ) Handles Timer1.Elapsed
MyTime = TimeOfDay
UTCTime = MyTime.ToUniver salTime()
TextBox1.Text() = UTCTime

End Sub

-Brett

"Stephany Young" wrote:
I think it is a bit imprudent to call it an error.

I, for example have never seen the bahaviour that has been described
regardless if the macine is in daylight saving time or not and also
regardless of whether or not daylight saving time has just cut in or out
as
the case may be.

I think the appropriate course of action is for the original poster to
identify the specific condition that is causing the behaviour in the
configuration of the machine in question.
"Crouchie19 98" <cr**********@s pamcop.net> wrote in message
news:Oj******** ******@tk2msftn gp13.phx.gbl...
> This came up a few weeks ago in this newsgroup. Basically, MS Explorer
> shows
> the correct time whereas the applications show MS Explorer time + 1
> hour.
> So, I guess it is an error
>
> Crouchie1998
> BA (HONS) MCP MCSE.
>
>


Nov 21 '05 #7
On Tue, 19 Apr 2005 10:04:05 -0700, "Brett Edman"
<Br********@dis cussions.micros oft.com> wrote:

I may be wrong, but I thought that UTC/GMT doesn't change with the
seasons, so here we are on BST at the moment or GMT +1

Doug Taylor
I changed my querey of the current time from:
TimeOfDay() to Now()
This fixes the problem

Brett

"Brett Edman" wrote:
I created a UTC clock using this:
UTCTime = MyTime.ToUniver salTime()
Now that we've turned the clocks ahead 1 hour for daylight savings time, the
clock is reporting the wrong UTC time. It is reporting UTC + 1 hour.
Is this a bug or is there a way I can querey for daylight time and make the
adjustment in my application?

Thanks.


Nov 21 '05 #8

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

Similar topics

0
3961
by: Jonatan Fernstad | last post by:
I am using the JavaMail API to send email. It seems the Message.setSentDate(new Date()) sets wrong time zone. I am at GMT+1, and this is also what the new Date() is showing. But when the message arrives the header is showing it as GMT+2. It is always showing one time zone higher also if I change my time zone to something else in windows.
9
1194
by: Admin | last post by:
I am creating a chat application like Messenger for the web (using the browser) and I'm wondering if there is a way to receive new messages from time to time from the server other than refreshing the page each 5 sec. If there were a way to have the server-side application send new messages to the browser this would be awesome because it...
3
2515
by: Russell Warren | last post by:
Does anyone know how long it takes for time.clock() to roll over under win32? I'm aware that it uses QueryPerformanceCounter under win32... when I've used this in the past (other languages) it is a great high-res 64-bit performance counter that doesn't roll-over for many (many) years, but I'm worried about how many bits Python uses for it...
5
6435
by: RICHARD BROMBERG | last post by:
I am writing an ASP program that includes a Form. When the Form is submitted I use the Date() and Time() functions to put the date and time into the Body part of the e-mail. The time reported is three hours earlier than the time at which the Form is actually submitted. I understand these functions are evaluated on the server so the server...
0
1036
by: amy | last post by:
it seems a bug of CDateTimeCtrl: if I try to set "2004/4/4 2:00" (which is daylight saving start time) to it, it always shows "2004/4/4 1:00". But when I set "2003/10/26 2:00" to it, it shows "2003/10/26 2:00".
0
1115
by: nishi.hirve | last post by:
Hello, I am writing one simple C# .NET application in which I have to use the values retrived from the database. But when I try to retrive value of attribute of type Time without time zone it generates following exception {"Index was outside the bounds of the array."} System.Exception {System.IndexOutOfRangeException}
9
8285
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the following to try to determine which. import time # Determine if time.time is better than time.clock # The one with better resolution should be...
0
1590
by: eneyardi | last post by:
I want to have my program time in, time out system. When someone login, automatically it will record the time it was in, and when logging out, it will record the time out. I want to have a database where the time in and time out will be recorded. anyone have any idea?
3
3426
by: beary | last post by:
Hi, My php website is showing the wrong time. I don't think it's a timezone thing. The website is running purely on my local machine under localhost. It's around 10 hours slow, which means when I login this morning, Monday morning, the date shows up as Sunday still. In my php.ini file, I have date.timezone = Australia/Hobart But I'm...
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3651
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2107
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 we have to send another system
0
936
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.