UTCNow<>格林威治标准时间 [英] UTCNow <> GMT

查看:45
本文介绍了UTCNow<>格林威治标准时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好


我正在尝试使用日期时间

对象的IsDaylightSavingTime属性。


我使用的PC是GMT,


DateTime.Now.IsDaylightSavingTime()返回true

DateTime.UtcNow.IsDaylightSavingTime()返回false


时间也相差1小时。


据我所知,GMT = UTC

< a rel =nofollowhref =http://www.dxing.com/utcgmt.htmtarget =_ blank> http://www.dxing.com/utcgmt.htm


但显然.NET认为不然。我迫切需要一个

的分辨率。


我知道如何使用VB.NET在GMT中获得时间吗?显然UtcNow是

*不是*一个选项。


提前谢谢。


尼克。

解决方案

您好,


任何有兴趣的人的解决方案,

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


TimeZoneInfo.FromStandardName(" GMT Standard

Time")。IsDaylightSavingTime()


似乎工作正常,不幸的是我不能使用.net 3.5中的

TimeZoneInfo类,因为我使用.net 2.0并且不认为

麻烦的更新是值得的。


请纠正我,如果我错了,但这应该做的...


尼克。


尼克 < a@a.com写了留言

新闻:%2 **************** @ TK2MSFTNGP06.phx.gbl ...


你好


我正在尝试使用datetime

对象的IsDaylightSavingTime属性。


我使用的PC是GMT,


DateTime.Now.IsDaylightSavingTime()返回true

DateTime .UtcNow.IsDaylightSavingTime()返回false


时间也相差1小时。


据我所知,GMT = UTC

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


但显然.NET认为不然。我迫切需要一个

的分辨率。


我知道如何使用VB.NET在GMT中获得时间吗?显然UtcNow是

*不是*一个选项。


提前谢谢。


尼克。



你显然没有很好地阅读该链接的网页。


它说明用这么多话来说,UTC曾经被称为GMT。这意味着

在过去的某个时刻它被称为GMT,但现在不再了。


说到Windows操作系统,GMT是时候了区域和UTC不是。 UTC是一个

概念,它构成了所有时区的基础。


你必须记住,在Windows操作系统中,时区更像是一个时区

切片世界。它实际上是世界的一部分,其中每个地方的每个地方都有相同的Dayligt Saving规则。


格林尼治标准时间的部分时间时区与由UTC代表的
相同,但在今年余下时间(夏令时),GMT

时区比UTC早1小时。


如果你想获得你所使用的当地日期/时间

DateTime.Now。请注意,DateTime.Now始终显示在您当前的

时区中,并且始终针对适用于该时区的

的夏令时规则进行调整。


如果你想在世界任何地方获得明确的日期/时间

然后使用DateTime.UtcNow。

" Nick" < a@a.com写了留言

新闻:%2 **************** @ TK2MSFTNGP06.phx.gbl ...


你好


我正在尝试使用datetime

对象的IsDaylightSavingTime属性。


我使用的PC是GMT,


DateTime.Now.IsDaylightSavingTime()返回true

DateTime .UtcNow.IsDaylightSavingTime()返回false


时间也相差1小时。


据我所知,GMT = UTC

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


但显然.NET认为不然。我迫切需要一个

的分辨率。


我知道如何使用VB.NET在GMT中获得时间吗?显然UtcNow是

*不是*一个选项。


提前谢谢。


尼克。


您好Stephany,


感谢您的信息,您显然没有看到我的后续回复非常

也很好。


它有一个解决问题的方法,因为UtcNow *不是*解决方案我在我的第一个发布。


谢谢。


尼克。


" Stephany Young" < noone @ localhostwrote in message

news:Os ************** @ TK2MSFTNGP04.phx.gbl ...


你显然没有很好地阅读该链接的网页。


它用很多话说,UTC曾经被称为GMT 。这意味着

在过去的某个时刻它被称为GMT,但现在已经不再了。


说到Windows操作系统,GMT是时候了区域和UTC不是。 UTC是一个

概念,它构成了所有时区的基础。


你必须记住,在Windows操作系统中,时区更像是一个时区

切片世界。它实际上是世界的一部分,其中每个地方的每个地方都有相同的Dayligt Saving规则。


格林尼治标准时间的部分时间时区与由UTC表示的

相同,但在今年余下时间(夏令时),

GMT时区比UTC早1小时。


如果你想获得你所使用的当地日期/时间

DateTime.Now。请注意,DateTime.Now始终在您当前的

时区中显示,并且始终针对适用于该时区的夏令时规则进行调整。


如果你想在世界任何地方获得明确的日期/时间

然后使用DateTime.UtcNow。


" ;尼克" < a@a.com写了留言

新闻:%2 **************** @ TK2MSFTNGP06.phx.gbl ...


>您好

我正在尝试使用日期时间
对象的IsDaylightSavingTime属性。
我使用的PC是GMT,

DateTime.Now.IsDaylightSavingTime()返回true
DateTime.UtcNow.IsDaylightSavingTime()返回false

时间也差不多1小时。

据我所知,GMT = UTC

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

但显然.NET认为不然。我迫切需要解决这个问题。

我知道如何使用VB.NET在GMT中获得时间吗?显然UtcNow是
*不是*一个选项。

提前致谢。

尼克。


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.

解决方案

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.



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.


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.



这篇关于UTCNow&lt;&gt;格林威治标准时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆