473,404 Members | 2,174 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

UTCNow <> GMT

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
DateTime.UtcNow.IsDaylightSavingTime() returns false

The times also differ by 1 hour.

As far as I was aware, GMT = UTC

http://www.dxing.com/utcgmt.htm

But quite evidently .NET thinks otherwise. I desperately need a
resolution to this.

Any idea how I get the time in GMT with VB.NET? Obviously UtcNow is
*not* an option.

Thanks in advance.

Nick.
Jul 18 '08 #1
36 4527
Hi there,

A solution for anyone interested,

http://www.codeproject.com/KB/vb/TimeZoneInfo.aspx

TimeZoneInfo.FromStandardName("GMT Standard
Time").IsDaylightSavingTime()

This seems to be working fine, unfortunately I can't use the
TimeZoneInfo classes in .net 3.5 as i'm using .net 2.0 and don't think the
hassle of updating is worth it.

Please correct me if I'm wrong but this should do the trick...

Nick.

"Nick" <a@a.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
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
DateTime.UtcNow.IsDaylightSavingTime() returns false

The times also differ by 1 hour.

As far as I was aware, GMT = UTC

http://www.dxing.com/utcgmt.htm

But quite evidently .NET thinks otherwise. I desperately need a
resolution to this.

Any idea how I get the time in GMT with VB.NET? Obviously UtcNow is
*not* an option.

Thanks in advance.

Nick.

Jul 18 '08 #2
You obviously didn't read the web page at that link very well.

It states, in so many words, that UTC used to be called GMT. That means that
at some point in the past it was called GMT but is not anymore.

When it comes to a Windows OS, GMT is a time zone and UTC is not. UTC is a
concept which forms the base of all time zones.

You must remember that to the Windows OS, a time zone is more that just a
slice of the world. It is actually a slice of the world where everywhere
within that slice share the same Dayligt Saving rules.

For part of the year the time in the GMT time zone is the same time as that
represented by UTC, but for rest of the year, (Daylight Saving), the GMT
time zone is 1 hour ahead of UTC.

If you want to get the local date/time where you are the you use
DateTime.Now. Note that DateTime.Now is always represented in your current
time zone and is always adjusted for the daylight saving rules that apply to
that time zone.

If you want to get a date/time that is unambiguous anywhere in the world
then use DateTime.UtcNow.
"Nick" <a@a.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
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
DateTime.UtcNow.IsDaylightSavingTime() returns false

The times also differ by 1 hour.

As far as I was aware, GMT = UTC

http://www.dxing.com/utcgmt.htm

But quite evidently .NET thinks otherwise. I desperately need a
resolution to this.

Any idea how I get the time in GMT with VB.NET? Obviously UtcNow is
*not* an option.

Thanks in advance.

Nick.
Jul 19 '08 #3
Hi Stephany,

Thanks for the info, you obviously didn't read my follow up reply very
well also.

It has a solution to said problem as UtcNow is *not* a solution which I
said in my first post.

Thanks.

Nick.

"Stephany Young" <noone@localhostwrote in message
news:Os**************@TK2MSFTNGP04.phx.gbl...
You obviously didn't read the web page at that link very well.

It states, in so many words, that UTC used to be called GMT. That means
that at some point in the past it was called GMT but is not anymore.

When it comes to a Windows OS, GMT is a time zone and UTC is not. UTC is a
concept which forms the base of all time zones.

You must remember that to the Windows OS, a time zone is more that just a
slice of the world. It is actually a slice of the world where everywhere
within that slice share the same Dayligt Saving rules.

For part of the year the time in the GMT time zone is the same time as
that represented by UTC, but for rest of the year, (Daylight Saving), the
GMT time zone is 1 hour ahead of UTC.

If you want to get the local date/time where you are the you use
DateTime.Now. Note that DateTime.Now is always represented in your current
time zone and is always adjusted for the daylight saving rules that apply
to that time zone.

If you want to get a date/time that is unambiguous anywhere in the world
then use DateTime.UtcNow.
"Nick" <a@a.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>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
DateTime.UtcNow.IsDaylightSavingTime() returns false

The times also differ by 1 hour.

As far as I was aware, GMT = UTC

http://www.dxing.com/utcgmt.htm

But quite evidently .NET thinks otherwise. I desperately need a
resolution to this.

Any idea how I get the time in GMT with VB.NET? Obviously UtcNow is
*not* an option.

Thanks in advance.

Nick.

Jul 19 '08 #4
lol! and you're right, I scan read a few pages that said GMT was UTC and
just posted the first link that had the most text on.

"Stephany Young" <noone@localhostwrote in message
news:Os**************@TK2MSFTNGP04.phx.gbl...
You obviously didn't read the web page at that link very well.

It states, in so many words, that UTC used to be called GMT. That means
that at some point in the past it was called GMT but is not anymore.

When it comes to a Windows OS, GMT is a time zone and UTC is not. UTC is a
concept which forms the base of all time zones.

You must remember that to the Windows OS, a time zone is more that just a
slice of the world. It is actually a slice of the world where everywhere
within that slice share the same Dayligt Saving rules.

For part of the year the time in the GMT time zone is the same time as
that represented by UTC, but for rest of the year, (Daylight Saving), the
GMT time zone is 1 hour ahead of UTC.

If you want to get the local date/time where you are the you use
DateTime.Now. Note that DateTime.Now is always represented in your current
time zone and is always adjusted for the daylight saving rules that apply
to that time zone.

If you want to get a date/time that is unambiguous anywhere in the world
then use DateTime.UtcNow.
"Nick" <a@a.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>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
DateTime.UtcNow.IsDaylightSavingTime() returns false

The times also differ by 1 hour.

As far as I was aware, GMT = UTC

http://www.dxing.com/utcgmt.htm

But quite evidently .NET thinks otherwise. I desperately need a
resolution to this.

Any idea how I get the time in GMT with VB.NET? Obviously UtcNow is
*not* an option.

Thanks in advance.

Nick.

Jul 19 '08 #5
The PC I am using is in GMT,

Are you sure of this?
>
DateTime.Now.IsDaylightSavingTime() returns true
DateTime.UtcNow.IsDaylightSavingTime() returns false
The times also differ by 1 hour.

As far as I was aware, GMT = UTC
Likewise I believe this to be true, but If you're in the uk right now for
instance, then you're actually in BST not GMT

--
Rory
Jul 19 '08 #6
Sthephany,

Sorry, but what you wrote is in my idea wrong: << UTC is a concept which
forms the base of all time zones >>.

Greenwich Mean Time is what UTC is based on. It is one of the few
measurements standards that is used worldwide invented by the British. As
you are once in Europe, you can go to the Thames river and you can see a
nice house in Greenwhich where is the machinery that holds the UTC time.

(As I recongnize the way of writting, it is very near where Nick lives).

Cor

Jul 19 '08 #7
Hi Nick,

I agree that UTC is not 100% match to the GMT you expected as GMT is a
timezone while UTC is more likely a baseline for sharing time amone world.
For your scenario, what's your application's actual requirement? So far in
..net framework, we cannot set a certain application process or thread as a
particular timezone, if you want to deal with datetime as the GMT zone, the
target machine's regional setting and timezone setting should match that.
then, you can just use the local time.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "Nick" <a@a.com>
References: <#Y**************@TK2MSFTNGP06.phx.gbl>
<Os**************@TK2MSFTNGP04.phx.gbl>
>Subject: Re: UTCNow <GMT
Date: Sat, 19 Jul 2008 09:01:45 +0100
>
lol! and you're right, I scan read a few pages that said GMT was UTC and
just posted the first link that had the most text on.

"Stephany Young" <noone@localhostwrote in message
news:Os**************@TK2MSFTNGP04.phx.gbl...
>You obviously didn't read the web page at that link very well.

It states, in so many words, that UTC used to be called GMT. That means
that at some point in the past it was called GMT but is not anymore.

When it comes to a Windows OS, GMT is a time zone and UTC is not. UTC is
a
>concept which forms the base of all time zones.

You must remember that to the Windows OS, a time zone is more that just
a
>slice of the world. It is actually a slice of the world where everywhere
within that slice share the same Dayligt Saving rules.

For part of the year the time in the GMT time zone is the same time as
that represented by UTC, but for rest of the year, (Daylight Saving),
the
>GMT time zone is 1 hour ahead of UTC.

If you want to get the local date/time where you are the you use
DateTime.Now. Note that DateTime.Now is always represented in your
current
>time zone and is always adjusted for the daylight saving rules that
apply
>to that time zone.

If you want to get a date/time that is unambiguous anywhere in the world
then use DateTime.UtcNow.
"Nick" <a@a.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>>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
DateTime.UtcNow.IsDaylightSavingTime() returns false

The times also differ by 1 hour.

As far as I was aware, GMT = UTC

http://www.dxing.com/utcgmt.htm

But quite evidently .NET thinks otherwise. I desperately need a
resolution to this.

Any idea how I get the time in GMT with VB.NET? Obviously UtcNow is
*not* an option.

Thanks in advance.

Nick.


Jul 21 '08 #8
Hi,

Nick wrote:
Any idea how I get the time in GMT with VB.NET? Obviously UtcNow is
*not* an option.
I for one am probably in a similar situation. I have an application that is
about to be used by field engineers all over the planet and uses a
WebService to synchronize data with a server in Germany. Even worse, those
engineers travel around the world and stay for a couple of days in one
location (probably not changing their PCs timezone to match the one they
are in) and a couple of months in another (most probably setting the time
zone).
Every record has its own timestamps (created, updated, deleted, last
sync'ed) and the sync-process of course heavily depends on those timetamps.
I thus need to find an invariant format in which timestamps are being
stored (UTC/GMT). The application would have to convert values retrieved
from the database on each PC according to the regional-/time-settings (and
vice versa).

I'm not sure what *you* are trying to accomplish, but I stumbled over ...
my.Computer.Clock.GmtTime
my.Computer.Clock.LocalTime

Using DateDiff on that would allow me to "convert" the timestamps as I
could simply do a DateDiff to get the difference in minutes and apply that
to my timestamps.
That said, I don't really need the DaylightSavings, just the difference to
a sort of global baseline such as GMT/UTC.

BTW - the description of the my.Computer.Clock.GmtTime property reads "Gets
a Date object that contains the current local date and time on the
computer, expressed as a UTC (GMT) time.". According to the information I
read here and at other places it seems that there really is a difference,
but in VS.Net both terms are used equivalently, hence I'm confused, too.

Any insights and/or hints appreciated here as well!

Cheers,
Olaf
Jul 21 '08 #9
Unless you are working in the actual GMT timezone, (that is The United
Kingdom of Great Britain and Northern Ireland, The Republic of Ireland and
Portugal), then forget about GMT.

If you need to deal with timestamps all around the world then you have 2
choices.

1. Store your timestamps as 'local time' in relation to the defined timezone
of the computer along with some information about the timezone. If you do
this you need to store the timezone information in such a manner that a
'local time' in say, Brazil, can be correctly displayed as a 'local time'
in, say, India. This entails converting the Brazilian value to UTC and then
converting the result to the appropriate Indian value.

2. Store your timestamps as Universal Time Coordinated (UTC). This requires
only one conversion when the value is finally displayed. For all other
purposes all values will automatically be 'in sync'.

To obtain a value in UTC, simply use the DateTime.UtcNow method.

To display a UTC value in local time, simply use the myvalue.ToLocalTime
method.

At present, it is 7:00 PM on July 21 2008 where I am.

Dim myvalue = DateTime.UtcNow()

gives 7:00 AM on July 21 2008.

If I pass that value to you and you execute:

Dim mylocal = myvalue.ToLocalTime()

you will get 9:00 AM on July 21 2008.

All you have to know is that any timestamp value that I pass to you is in
UTC.

As to people travelling and not adjusting their timezones, then

myvalue.ToLocalTime()

will convert based on the timezone that the machine is set to.

If they are in India and the timezone of the machine is set to Brazil the
the result will be converted to Brazilian local time.

"Olaf Rabbachin" <Ol*********@IntuiDev.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
Hi,

Nick wrote:
>Any idea how I get the time in GMT with VB.NET? Obviously UtcNow is
*not* an option.

I for one am probably in a similar situation. I have an application that
is
about to be used by field engineers all over the planet and uses a
WebService to synchronize data with a server in Germany. Even worse, those
engineers travel around the world and stay for a couple of days in one
location (probably not changing their PCs timezone to match the one they
are in) and a couple of months in another (most probably setting the time
zone).
Every record has its own timestamps (created, updated, deleted, last
sync'ed) and the sync-process of course heavily depends on those
timetamps.
I thus need to find an invariant format in which timestamps are being
stored (UTC/GMT). The application would have to convert values retrieved
from the database on each PC according to the regional-/time-settings (and
vice versa).

I'm not sure what *you* are trying to accomplish, but I stumbled over ...
my.Computer.Clock.GmtTime
my.Computer.Clock.LocalTime

Using DateDiff on that would allow me to "convert" the timestamps as I
could simply do a DateDiff to get the difference in minutes and apply that
to my timestamps.
That said, I don't really need the DaylightSavings, just the difference to
a sort of global baseline such as GMT/UTC.

BTW - the description of the my.Computer.Clock.GmtTime property reads
"Gets
a Date object that contains the current local date and time on the
computer, expressed as a UTC (GMT) time.". According to the information I
read here and at other places it seems that there really is a difference,
but in VS.Net both terms are used equivalently, hence I'm confused, too.

Any insights and/or hints appreciated here as well!

Cheers,
Olaf
Jul 21 '08 #10
Hey Cor!
(As I recongnize the way of writting, it is very near where Nick lives).
haha, indeed it is I. How the devil are you these days?

Nick.
Jul 21 '08 #11
Hi Rory,
Are you sure of this?
Uhh well I thought I was until you said...
Likewise I believe this to be true, but If you're in the uk right now for
instance, then you're actually in BST not GMT
That's strange, I wasn't aware that the timezone name changed when in
summertime? Learn something new everyday LOL!

With that said the class from the code project worked well with the code I
posted and knows that we are in summer time so all is well on that front.

Nick.
Jul 21 '08 #12
Hi Stephany,
Unless you are working in the actual GMT timezone, (that is The United
Kingdom of Great Britain and Northern Ireland, The Republic of Ireland and
Portugal), then forget about GMT.
Unfortunately that rule, although correct to a certain extend, unless
the code you are trying to integrate has done likewise, you are onto a loss
from the word go. The site I'm parsing refers to a GMT offset no matter
where you are in the world but does not compensate for daylight savings,
hence my predicament.

If the site had been code as you suggest, using UTC throughout until
display time, when you convert to local them, my problems wouldn't have
existed in the first place. But never mind, it's all working great now, and
I appreciated your information even though that might not have come across
in my reply.

Nick.
Jul 21 '08 #13
Cor Ligthert[MVP] wrote:
Sthephany,

Sorry, but what you wrote is in my idea wrong: << UTC is a concept
which forms the base of all time zones >>.
I don't understand your idea... That is exactly what it is.

"Time zones around the world are expressed as positive or negative
offsets from UTC. Local time is UTC plus the time zone offset for that
location, plus an offset (typically +1) for daylight saving time, if in
effect. UTC replaced Greenwich Mean Time on 1 January 1972 as the basis
for the main reference time scale or civil time in various regions."

http://en.wikipedia.org/wiki/Coordinated_Universal_Time

Greenwich Mean Time is what UTC is based on.
Maybe in a historical sence, as UTC replaced GMT, but not in any
practical sence.

"Greenwich Mean Time (GMT) is a term originally referring to mean solar
time at the Royal Observatory in Greenwich, London. It is now often used
to refer to Coordinated Universal Time (UTC) when this is viewed as a
time zone"

"UT1, introduced in 1928, represents earth rotation time. Leap seconds
are added to or subtracted from UTC to keep it within 0.9 seconds of UT1."

http://en.wikipedia.org/wiki/Gmt

So, GMT is based on UTC, which is based on UT1.

--
Göran Andersson
_____
http://www.guffa.com
Jul 21 '08 #14
Hello Nick,
>Likewise I believe this to be true, but If you're in the uk right now
for instance, then you're actually in BST not GMT
That's strange, I wasn't aware that the timezone name changed when in
summertime? Learn something new everyday LOL!
If I understand things correctly GMT and UTC are static which is to say they
do not change with respect to any Summer time / Daylight savings time.

However the Uk observes "British summer time (BST)" as such ,at the start
of the summer, the Uk shifts from GMT/UTC into BST. If you are in the Uk
and your computer notices this then when you ask for "Now" then you will
be given the Local time (ie BST) and therefore explains why the following
happends...
-------------------------------------------------------------
DateTime.Now.IsDaylightSavingTime() returns true
DateTime.UtcNow.IsDaylightSavingTime() returns false
-------------------------------------------------------------

Again, if I understand things correctly, a UTC Time should never return true
for "IsDaylightSavingTime"
Whilst "Now" will will return true if the current Local is currently experiencing
Daylight savings. At the moment the UK is and so it returns true.
I hope this helps

--
Rory
Jul 21 '08 #15
Rory Becker wrote:
Hello Nick,
>>Likewise I believe this to be true, but If you're in the uk right now
for instance, then you're actually in BST not GMT
That's strange, I wasn't aware that the timezone name changed when in
summertime? Learn something new everyday LOL!

If I understand things correctly GMT and UTC are static which is to say
they do not change with respect to any Summer time / Daylight savings time.
For UTC that is certainly true.

GMT is mostly used as a base for time zones, for example (GMT+1).
Depending on whether daylights savings time is active or not, this can
mean be (UTC+1) or (UTC+2). Therefore, the meaning of GMT would be
different depending on whether you mean GMT or (GMT+0), the first
meaning UTC and the second meaning the Greenwich time zone. As "+0"
isn't even spelled out when used as a time zone, the meaning depends on
the situation...
the Uk and your computer notices this then when you ask for "Now" then
you will be given the Local time (ie BST) and therefore explains why the
following happends...
-------------------------------------------------------------
DateTime.Now.IsDaylightSavingTime() returns true
DateTime.UtcNow.IsDaylightSavingTime() returns false
-------------------------------------------------------------

Again, if I understand things correctly, a UTC Time should never return
true for "IsDaylightSavingTime"
Yes, that is correct.
Whilst "Now" will will return true if the current Local is currently
experiencing Daylight savings. At the moment the UK is and so it returns
true.

I hope this helps

--
Rory


--
Göran Andersson
_____
http://www.guffa.com
Jul 21 '08 #16
Hello Göran,
GMT is mostly used as a base for time zones, for example (GMT+1).
Depending on whether daylights savings time is active or not, this can
mean be (UTC+1) or (UTC+2).
Can you point to some reference from which you gather this...?

From http://www.timeanddate.com/library/a...es/eu/gmt.html

"GMT is in the same time zone as Coordinated Universal Time (UTC)"

There are no exceptions listed.

GMT = UTC = BST-1
GMT+1 = UTC+1 = BST
GMT+2 = UTC+2 = BST+1

The only issue here is that "Now" returns the Localized time. So if your
local is observing BST, then "Now" returns BST and you need to be aware that
simply being in the uk (where Greenwich is) is not enough to say you are
in GMT as the uk observes BST at suitable points during the year instead.
Therefore, the meaning of GMT would be
different depending on whether you mean GMT or (GMT+0), the first
meaning UTC and the second meaning the Greenwich time zone. As "+0"
isn't even spelled out when used as a time zone, the meaning depends
on the situation...
--
Rory
Jul 21 '08 #17
Rory Becker wrote:
Hello Göran,
>GMT is mostly used as a base for time zones, for example (GMT+1).
Depending on whether daylights savings time is active or not, this can
mean be (UTC+1) or (UTC+2).

Can you point to some reference from which you gather this...?
"Greenwich Mean Time (GMT) is a term originally referring to mean solar
time at the Royal Observatory in Greenwich, London. It is now often used
to refer to Coordinated Universal Time (UTC) when this is viewed as a
time zone"

http://en.wikipedia.org/wiki/Gmt
From
http://www.timeanddate.com/library/a...es/eu/gmt.html

"GMT is in the same time zone as Coordinated Universal Time (UTC)"
UTC is not a time zone, it's the universal time. Time zones are defined
relative to UTC.
There are no exceptions listed.

GMT = UTC = BST-1
GMT+1 = UTC+1 = BST
GMT+2 = UTC+2 = BST+1
A time zone is a geographical area, so BST isn't actually a time zone.
It's just a name for the time used in a time zone a part of the year.
When the people in the zone switches from using BST to GMT, they are
still in the same time zone...
The only issue here is that "Now" returns the Localized time. So if your
local is observing BST, then "Now" returns BST and you need to be aware
that simply being in the uk (where Greenwich is) is not enough to say
you are in GMT as the uk observes BST at suitable points during the year
instead.
>Therefore, the meaning of GMT would be
different depending on whether you mean GMT or (GMT+0), the first
meaning UTC and the second meaning the Greenwich time zone. As "+0"
isn't even spelled out when used as a time zone, the meaning depends
on the situation...

--
Rory


--
Göran Andersson
_____
http://www.guffa.com
Jul 21 '08 #18
Hello Göran,

I think we are outside the OP original point by now however.....
>>GMT is mostly used as a base for time zones, for example (GMT+1).
Depending on whether daylights savings time is active or not, this
can mean be (UTC+1) or (UTC+2).
Can you point to some reference from which you gather this...?
"Greenwich Mean Time (GMT) is a term originally referring to mean
solar time at the Royal Observatory in Greenwich, London. It is now
often used to refer to Coordinated Universal Time (UTC) when this is
viewed as a time zone"

http://en.wikipedia.org/wiki/Gmt
I meant for you to supply a reference as to how GMT+1 could in some cases
be UTC+1 and in other cases be UTC+2. I do not see how this can be the case.
The uk switches from GMT to BST and back again, but GMT itself and UTC remain
static and (near enough) identical to one another. Is this not so?

GMT+1 can never be the same as UTC+2.

Now that I reread what you wrote, I am not sure I interpreted what you said
correctly. I'm fairly sure we agree. Sorry to anyone who might have become
confused by what I have said :)

--
Rory
Jul 21 '08 #19
JHB
Here is a good reference. Look for time zones.

A Guided Tour to Time Measurement
http://toi.iriti.cnr.it/en/toi.html

The US Naval Observatory is a good source of information on time.
http://tycho.usno.navy.mil/

I think his example might be better written
>>(for example (GMT+1).
Depending on whether daylights savings time is active or not, this
can mean be (GMT+1) or (GMT+2).).
Jul 22 '08 #20
The UK is in the GMT timezone. For part of the year the UK observes Daylight
Saving.

The GMT timezone is UTC+0 (with a bias of +60 minutes for Daylight Saving).

When the UK enters Daylight Saving, it's timezone is NOT renamed. Instead,
an alias of BST is used.

Here is New Zealand the timezone is NZST or New Zealand Standard Time
(UTC+12) and the alias for daylight saving is NZDT or New Zealand Daylight
Time (UTC+12 + another 60 minutes).

So you see, timezones are NOT renamed, we simply use an alternative
monicker.

Also you need to reverse you thinking, because GMT is based on UTC and NOT
the other way round.

Therefore:

GMT = UTC+0
BST = UTC+0 + another 60 minutes

By extrapolation GMT can never be UTC+1 or UTC+2.

Well, it is possible, but it would involve the UK land mass up and moving 15
degrees or more to the east. Somehow I don't think that's going to happen
until the Earth get's hit by a very big object from outer space and, if that
happened then what timezone we were in would be the least of our worries.
I meant for you to supply a reference as to how GMT+1 could in some cases
be UTC+1 and in other cases be UTC+2. I do not see how this can be the
case. The uk switches from GMT to BST and back again, but GMT itself and
UTC remain static and (near enough) identical to one another. Is this not
so?

"Rory Becker" <ro********@newsgroup.nospamwrote in message
news:3a**************************@news.microsoft.c om...
Hello Göran,

I think we are outside the OP original point by now however.....
>>>GMT is mostly used as a base for time zones, for example (GMT+1).
Depending on whether daylights savings time is active or not, this
can mean be (UTC+1) or (UTC+2).

Can you point to some reference from which you gather this...?
"Greenwich Mean Time (GMT) is a term originally referring to mean
solar time at the Royal Observatory in Greenwich, London. It is now
often used to refer to Coordinated Universal Time (UTC) when this is
viewed as a time zone"

http://en.wikipedia.org/wiki/Gmt

I meant for you to supply a reference as to how GMT+1 could in some cases
be UTC+1 and in other cases be UTC+2. I do not see how this can be the
case. The uk switches from GMT to BST and back again, but GMT itself and
UTC remain static and (near enough) identical to one another. Is this not
so?

GMT+1 can never be the same as UTC+2.

Now that I reread what you wrote, I am not sure I interpreted what you
said correctly. I'm fairly sure we agree. Sorry to anyone who might have
become confused by what I have said :)
--
Rory

Jul 22 '08 #21
Hi,

Nick wrote:
The class of code project helped solve that problem. It's slightly odd
that the site refers to GMT no matter where you are in the world, but then
it's something that could be worked around so all is well!
have you read the comments to the CP-article?
I for one don't want to rely on using registry values that might differ
depending on the OS, that might be change with new OS-versions or even
might be subject to change without notice.

Cheers,
Olaf
Jul 22 '08 #22
Hi,

Stephany Young wrote:
2. Store your timestamps as Universal Time Coordinated (UTC). This requires
only one conversion when the value is finally displayed. For all other
purposes all values will automatically be 'in sync'.

To obtain a value in UTC, simply use the DateTime.UtcNow method.

To display a UTC value in local time, simply use the myvalue.ToLocalTime
method.
that is the exact approach that I originally intended to implement.

However, the discussions in this thread really got me confused/thinking as
to whether DateTime.UtcNow.ToLocalTime() will always consider the correct
value for Daylight Savings. :-)

Of course I can't do anything if users haven't set their timezone right,
but actually I don't really need to care. The important thing really is to
assure that, when synchronizing their data over my WebService, users
read/write the right data, according to the timestamps in their records.
Even if UTCNow wouldn't return the right value on some systems, that would
be sort of a permanent issue and thus not be a problem.

Cheers,
Olaf
Jul 22 '08 #23
Hi Olaf,

It's not exactly a mission critical application so if it does change in
the future then I shall modify the code to suit different versions of the
OS.

But as it stands, this seems like the best way to get the time in GMT.
Unless you have any other suggestions of course?

Nick.

"Olaf Rabbachin" <Ol*********@IntuiDev.comwrote in message
news:OS*************@TK2MSFTNGP02.phx.gbl...
Hi,

Nick wrote:
> The class of code project helped solve that problem. It's slightly
odd
that the site refers to GMT no matter where you are in the world, but
then
it's something that could be worked around so all is well!

have you read the comments to the CP-article?
I for one don't want to rely on using registry values that might differ
depending on the OS, that might be change with new OS-versions or even
might be subject to change without notice.

Cheers,
Olaf

Jul 22 '08 #24
Also you need to reverse you thinking, because GMT is based on UTC and NOT
the other way round.
How can GMT possibly be based around UTC? GMT was decided long before UTC
was created surely??
Jul 22 '08 #25
"Nick" <a@a.comschrieb
Also you need to reverse you thinking, because GMT is based on UTC
and NOT the other way round.

How can GMT possibly be based around UTC? GMT was decided long
before UTC was created surely??
UTC is not the historic base. UTC is the base for calculations. That's what
Stephany probably ment (did you?).
Armin

Jul 22 '08 #26
No, that's NOT what I meant.

I meant exactly what I wrote.
"Armin Zingler" <az*******@freenet.dewrote in message
news:ul**************@TK2MSFTNGP04.phx.gbl...
"Nick" <a@a.comschrieb
Also you need to reverse you thinking, because GMT is based on UTC
and NOT the other way round.

How can GMT possibly be based around UTC? GMT was decided long
before UTC was created surely??

UTC is not the historic base. UTC is the base for calculations. That's
what Stephany probably ment (did you?).
Armin
Jul 23 '08 #27
Time (sic) for a short (and abridged) history of GMT.

At sometime in the distant past, one of the King's of England decreed that
an observatory would be built on some land he granted for the purpose at
Greenwich.

At some point in the 18th century, the need to be able to calculate
longitude correctly became an issue for maritime navigators. As part of the
solution for the longitude 'problem' a line of reference was required.
Purely for the sake of convenience, the scientists decided to draw an
imaginary line from the North Pole to the South Pole taht ran throught the
Greenwich Observatory building. This line is called the Prime Meridian and
the time anywhere along that line was considered to be Greenwich Mean Time
or GMT, which was recognised as the basis for calculating local times.

Fast forward a couple of hundred years.

In the the 1950's and 1960's scientists found that the standard methodology
for calculating time based on GMT was not accurate enough for modern
purposes, (air travel, space travel, telecommunications, etc.). Around this
time the atomic clock was also developed. After much gnashing of teeth and
tearing of hair, an International Convention determined that GMT would no
longer be used as the basis for calculating local times. Instead they
introduced an International Standard named Universal Time Coordinated or
UTC.

The base for UTC is the Prime meridian, (just like GMT was), so it appears
to the great unwashed that UTC and GMT are one and the same thing.

This widespread misunderstanding is the crux of the whole issue.

UTC is the basis for time calculations and GMT is a timezone.

Then to top it all off, human nature comes into the equation. If you rename
something then an waful lot of people are going to continue to call it what
they always called it and no amount if education is going to change that.

Unfortunately, in this case, UTC is not GMT with a new name. UTC replaced
GMT as the International Standard, but GMT still continues as a time zone.

The GMT timezone is defined as UTC+0. When daylight saving is in place in
the UK it is UTC+0 plus another 60 minutes and the alias BST is used instead
of GMT.

So you see, GMT is based on UTC and not the other way round.
"Nick" <a@a.comwrote in message
news:u%****************@TK2MSFTNGP02.phx.gbl...
>Also you need to reverse you thinking, because GMT is based on UTC and
NOT the other way round.

How can GMT possibly be based around UTC? GMT was decided long before UTC
was created surely??
Jul 23 '08 #28
Stephany,

I assume that you have the same theory about English; That it is a
coincidence that the language started in England, but that it is based on
the International Dictionary for English.

You describe exactly that UTC inherits GMT.

Cor

"Stephany Young" <noone@localhostschreef in bericht
news:O9**************@TK2MSFTNGP02.phx.gbl...
Time (sic) for a short (and abridged) history of GMT.

At sometime in the distant past, one of the King's of England decreed that
an observatory would be built on some land he granted for the purpose at
Greenwich.

At some point in the 18th century, the need to be able to calculate
longitude correctly became an issue for maritime navigators. As part of
the solution for the longitude 'problem' a line of reference was required.
Purely for the sake of convenience, the scientists decided to draw an
imaginary line from the North Pole to the South Pole taht ran throught the
Greenwich Observatory building. This line is called the Prime Meridian and
the time anywhere along that line was considered to be Greenwich Mean Time
or GMT, which was recognised as the basis for calculating local times.

Fast forward a couple of hundred years.

In the the 1950's and 1960's scientists found that the standard
methodology for calculating time based on GMT was not accurate enough for
modern purposes, (air travel, space travel, telecommunications, etc.).
Around this time the atomic clock was also developed. After much gnashing
of teeth and tearing of hair, an International Convention determined that
GMT would no longer be used as the basis for calculating local times.
Instead they introduced an International Standard named Universal Time
Coordinated or UTC.

The base for UTC is the Prime meridian, (just like GMT was), so it appears
to the great unwashed that UTC and GMT are one and the same thing.

This widespread misunderstanding is the crux of the whole issue.

UTC is the basis for time calculations and GMT is a timezone.

Then to top it all off, human nature comes into the equation. If you
rename something then an waful lot of people are going to continue to call
it what they always called it and no amount if education is going to
change that.

Unfortunately, in this case, UTC is not GMT with a new name. UTC replaced
GMT as the International Standard, but GMT still continues as a time zone.

The GMT timezone is defined as UTC+0. When daylight saving is in place in
the UK it is UTC+0 plus another 60 minutes and the alias BST is used
instead of GMT.

So you see, GMT is based on UTC and not the other way round.
"Nick" <a@a.comwrote in message
news:u%****************@TK2MSFTNGP02.phx.gbl...
>>Also you need to reverse you thinking, because GMT is based on UTC and
NOT the other way round.

How can GMT possibly be based around UTC? GMT was decided long before
UTC was created surely??
Jul 23 '08 #29
Hello Stephany,
The GMT timezone is defined as UTC+0.
I don't care which way around the definition works as long as we agree that
they are *always* equivilent
When daylight saving is in place
in the UK it is UTC+0 plus another 60 minutes and the alias BST is
used instead of GMT.
In this statement 'it' seems to be a reference to GMT. If true, this implies
that during this period the value of GMT shifts by 1 hour.

I admit that I may be misinterpretting your words, but if I can then others
might.

I believe/hope that your intention was to suggest that "Local time" rather
than "GMT" shifts by an hour and that this new time is known as BST.

GMT cannot shift as there are countries along this geographical Time-Zone
which do not observe any form of Summer Time adjustment.

Again my appologies for continuing this thread. My reasoning is that I am
a native English speaker (Perhaps not the best ;)) resident in England, Uk
and I must admit that parts of this thread definitely have had me confused
as to the nature of this system (UTC, GMT, BST, Others) at times. I can only
imagine the trouble that someone who is not a native English speaking person
*might* have.

I hope that the thread as a whole helps someone :)

--
Rory
Jul 23 '08 #30
Your local time is GMT, even during daylight saving. During daylight saving
it (GMT) is offset by 60 minutes and, for the purposes of the daylight
saving period, in called by the alias BST.

All countries, and in some cases, parts of countries, that are in the same
time zone share the same offset from UTC and the same daylight saving rules
(start date/time, end date/time and bias).

The only countries in the GMT time zone are:
The United Kingdom of Great Britain and Northern Ireland
The Republic of Ireland
Portugal
"Rory Becker" <ro********@newsgroup.nospamwrote in message
news:3a**************************@news.microsoft.c om...
Hello Stephany,
>The GMT timezone is defined as UTC+0.

I don't care which way around the definition works as long as we agree
that they are *always* equivilent
>When daylight saving is in place
in the UK it is UTC+0 plus another 60 minutes and the alias BST is
used instead of GMT.

In this statement 'it' seems to be a reference to GMT. If true, this
implies that during this period the value of GMT shifts by 1 hour.

I admit that I may be misinterpretting your words, but if I can then
others might.

I believe/hope that your intention was to suggest that "Local time" rather
than "GMT" shifts by an hour and that this new time is known as BST.
GMT cannot shift as there are countries along this geographical Time-Zone
which do not observe any form of Summer Time adjustment.

Again my appologies for continuing this thread. My reasoning is that I am
a native English speaker (Perhaps not the best ;)) resident in England, Uk
and I must admit that parts of this thread definitely have had me confused
as to the nature of this system (UTC, GMT, BST, Others) at times. I can
only imagine the trouble that someone who is not a native English speaking
person *might* have.

I hope that the thread as a whole helps someone :)

--
Rory

Jul 23 '08 #31
Rory Becker wrote:
Hello Göran,

I think we are outside the OP original point by now however.....
>>>GMT is mostly used as a base for time zones, for example (GMT+1).
Depending on whether daylights savings time is active or not, this
can mean be (UTC+1) or (UTC+2).

Can you point to some reference from which you gather this...?
"Greenwich Mean Time (GMT) is a term originally referring to mean
solar time at the Royal Observatory in Greenwich, London. It is now
often used to refer to Coordinated Universal Time (UTC) when this is
viewed as a time zone"

http://en.wikipedia.org/wiki/Gmt

I meant for you to supply a reference as to how GMT+1 could in some
cases be UTC+1 and in other cases be UTC+2. I do not see how this can be
the case. The uk switches from GMT to BST and back again, but GMT itself
and UTC remain static and (near enough) identical to one another. Is
this not so?

GMT+1 can never be the same as UTC+2.

Now that I reread what you wrote, I am not sure I interpreted what you
said correctly. I'm fairly sure we agree. Sorry to anyone who might have
become confused by what I have said :)
--
Rory
Sorry if I'm unclear, it's important to distinguish between time zones
and time offsets when we get into the specifics...

A time zone that uses GMT+1 would, when daylight savings time is active,
be two hours ahead of the UTC time. That's what I meant. :)

--
Göran Andersson
_____
http://www.guffa.com
Jul 23 '08 #32
Wow, chill Winston!

"Stephany Young" <noone@localhostwrote in message
news:%2***************@TK2MSFTNGP02.phx.gbl...
No, that's NOT what I meant.

I meant exactly what I wrote.
"Armin Zingler" <az*******@freenet.dewrote in message
news:ul**************@TK2MSFTNGP04.phx.gbl...
>"Nick" <a@a.comschrieb
>Also you need to reverse you thinking, because GMT is based on UTC
and NOT the other way round.

How can GMT possibly be based around UTC? GMT was decided long
before UTC was created surely??

UTC is not the historic base. UTC is the base for calculations. That's
what Stephany probably ment (did you?).
Armin

Jul 23 '08 #33
Hello Stephany,
Your local time is GMT, even during daylight saving. During daylight
saving it (GMT) is offset by 60 minutes and, for the purposes of the
daylight saving period, in called by the alias BST.
My system is set to GMT and set to adjust for daylight savings.
In my immediate window.....
-------------------------------------------------------------
? Now<enter>
#7/23/2008 2:56:12 PM#
? Now.ToUniversalTime<enter>
#7/23/2008 1:56:27 PM#
-------------------------------------------------------------
This would seem to prove.....
...."Now" returns a value which is presadjusted for BST because that's the
current local time.
...."Now.ToUniversalTime" returns UTC/GMT.
The msdn help for "DateTime.Now" says....
-------------------------------------------------------------
URL = http://msdn.microsoft.com/en-us/libr...etime.now.aspx
-------------------------------------------------------------
Gets a DateTime object that is set to the current date and time on this computer,
expressed as the local time.
-------------------------------------------------------------

I still say that my local time is *currently* BST not GMT.
Although I think it might be entirely fair to say that my geographic timezone
is GMT.

--
Rory

Jul 23 '08 #34
Rory,

No one in Europe will believe that in Portugal BST would be used.

It is just Summer Time (as official registrated like that by the EU)

http://en.wikipedia.org/wiki/European_Summer_Time

In England is as well used as BST like in Eire IST.

However it is accoording the standards in the EU for European Summer Time

Cor
"Rory Becker" <ro********@newsgroup.nospamschreef in bericht
news:3a**************************@news.microsoft.c om...
Hello Stephany,
>Your local time is GMT, even during daylight saving. During daylight
saving it (GMT) is offset by 60 minutes and, for the purposes of the
daylight saving period, in called by the alias BST.

My system is set to GMT and set to adjust for daylight savings.
In my immediate window.....
-------------------------------------------------------------
? Now<enter>
#7/23/2008 2:56:12 PM#
? Now.ToUniversalTime<enter>
#7/23/2008 1:56:27 PM#
-------------------------------------------------------------
This would seem to prove.....
..."Now" returns a value which is presadjusted for BST because that's the
current local time.
..."Now.ToUniversalTime" returns UTC/GMT.
The msdn help for "DateTime.Now" says....
-------------------------------------------------------------
URL = http://msdn.microsoft.com/en-us/libr...etime.now.aspx
-------------------------------------------------------------
Gets a DateTime object that is set to the current date and time on this
computer, expressed as the local time.
-------------------------------------------------------------

I still say that my local time is *currently* BST not GMT. Although I
think it might be entirely fair to say that my geographic timezone is GMT.

--
Rory
Jul 23 '08 #35
Olaf Rabbachin wrote:
Hi,

Stephany Young wrote:
>2. Store your timestamps as Universal Time Coordinated (UTC). This requires
only one conversion when the value is finally displayed. For all other
purposes all values will automatically be 'in sync'.

To obtain a value in UTC, simply use the DateTime.UtcNow method.

To display a UTC value in local time, simply use the myvalue.ToLocalTime
method.

that is the exact approach that I originally intended to implement.

However, the discussions in this thread really got me confused/thinking as
to whether DateTime.UtcNow.ToLocalTime() will always consider the correct
value for Daylight Savings. :-)

Of course I can't do anything if users haven't set their timezone right,
but actually I don't really need to care. The important thing really is to
assure that, when synchronizing their data over my WebService, users
read/write the right data, according to the timestamps in their records.
Even if UTCNow wouldn't return the right value on some systems, that would
be sort of a permanent issue and thus not be a problem.

Cheers,
Olaf
If you use DateTime.GetUtc, you get a linear time that is independent of
time zones and daylight savings time, so whatever settings the user has,
you get the correct time. (Unless the clock is actually set to an
incorrect time, but most computers get the time from an internet server
nowadays so that should rarely be the case.)

When you use the ToLocalTime method to convert the time to display it,
it will be correct according to the settings of the computer. If the
settings are wrong, and later corrected, the time will display
correctly. As you store the time as UTC, all previously stored times
will also then display correctly.

--
Göran Andersson
_____
http://www.guffa.com
Jul 24 '08 #36
By George, I think she's got it.
"Rory Becker" <ro********@newsgroup.nospamwrote in message
news:3a**************************@news.microsoft.c om...
Hello Stephany,
>Your local time is GMT, even during daylight saving. During daylight
saving it (GMT) is offset by 60 minutes and, for the purposes of the
daylight saving period, in called by the alias BST.

My system is set to GMT and set to adjust for daylight savings.
In my immediate window.....
-------------------------------------------------------------
? Now<enter>
#7/23/2008 2:56:12 PM#
? Now.ToUniversalTime<enter>
#7/23/2008 1:56:27 PM#
-------------------------------------------------------------
This would seem to prove.....
..."Now" returns a value which is presadjusted for BST because that's the
current local time.
..."Now.ToUniversalTime" returns UTC/GMT.
The msdn help for "DateTime.Now" says....
-------------------------------------------------------------
URL = http://msdn.microsoft.com/en-us/libr...etime.now.aspx
-------------------------------------------------------------
Gets a DateTime object that is set to the current date and time on this
computer, expressed as the local time.
-------------------------------------------------------------

I still say that my local time is *currently* BST not GMT. Although I
think it might be entirely fair to say that my geographic timezone is GMT.

--
Rory
Jul 24 '08 #37

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

Similar topics

2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
1
by: JezB | last post by:
I'm binding a DataGrid web-control to data fetched from a database. However some of my data fields contain text that is within <...> characters - I notice that everything between the <> is...
1
by: RJN | last post by:
Hi I'm using XMLTextReader to parse the contents of XML. I have issues when the xml content itself has some special characters like & ,> etc. <CompanyName>Johnson & Jhonson</CompanyName>...
1
by: mike | last post by:
I've got some code like this: gametype_id = Request.Form("gametype_id") response.write "<br>gametype_id from form>" & gametype_id & "<" response.write "<br>gametype_id from database>" &...
3
by: ajay2552 | last post by:
Hi, I have a query. All html tags start with < and end with >. Suppose i want to display either '<' or '>' or say some text like '<Company>' in html how do i do it? One method is to use &lt,...
14
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the...
3
by: Josh Valino | last post by:
Hi, I have a client that has our product and in one of the aspx files, there is code like this: <%= SomePublicProperty %> where the public property returns a string. In the test...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
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,...
0
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...

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.