日期和时区 [英] Dates and time zones

查看:86
本文介绍了日期和时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!


我已经构建了一个程序,向用户显示一些日期。

用户有不同配置的时区机器时出现问题,其中:


- 确定显示日期时区的一台机器是01/01 / 2006.

- 在其他不同的机器(和其他配置的时区),显示日期

是12/31/2006 19:00:00


如果我将这两台机器的时区重新定义为相同的日期

工作正常。


我认为:如果日期注册为01/01/2006,则应在01/01/2006中显示

,与在CultureInfo类中修复它无关。或者我错了?


为什么会发生这种情况以及如何解决?


[] s

Cesar

Hello!

I''ve built a program that show some dates to users. I got a problem when
users have different configured time zone machines, where:

- One machine that determined time zone the date displayed is 01/01/2006.
- In other different machine (and other configured time zone), the date
displayed is 12/31/2006 19:00:00

If I redefine the time zones of these two machines to the same, the date
works fine.

I think this: if the date is registered as 01/01/2006, it should be showed
as 01/01/2006, independent of fix it in CultureInfo class. Or I''m wrong?

Why does this happen and how to resolve it?

[]s
Cesar

推荐答案

" Cesar Ronchese" < ronchese_hotmail_dot_com> schrieb
"Cesar Ronchese" <ronchese_hotmail_dot_com> schrieb
你好!

我已经建立了一个程序,向用户显示一些日期。我遇到了一个问题
当用户有不同的配置时区机器时,其中:

- 一台机器确定显示日期的时区是
01/01/2006。 - 在其他不同的机器(和其他配置的时间区域)中,显示的日期是12/31/2006 19:00:00

如果我将这两台机器的时区重新定义为同样,
日期工作正常。

我认为:如果日期已注册为01/01/2006,则应显示为01/01/2006 ,独立于在CultureInfo类中修复它。或者我错了?

为什么会发生这种情况以及如何解决?
Hello!

I''ve built a program that show some dates to users. I got a problem
when users have different configured time zone machines, where:

- One machine that determined time zone the date displayed is
01/01/2006. - In other different machine (and other configured time
zone), the date displayed is 12/31/2006 19:00:00

If I redefine the time zones of these two machines to the same, the
date works fine.

I think this: if the date is registered as 01/01/2006, it should be
showed as 01/01/2006, independent of fix it in CultureInfo class. Or I''m
wrong?

Why does this happen and how to resolve it?



您使用的是哪个版本的VB? 2003年还是2005年?我问,因为DateTime现在有一个属性''Kind''

。除此之外:你从哪里获得DateTime?

你在哪里存储它(变量的类型)?你是如何展示它的?变量中的

值是多少?

Armin


Which version of VB do you use? 2003 or 2005? I ask because DateTime now has
a property ''Kind''. Apart from this: Where do you get the DateTime from?
Where do you store it (type of variable)? How do you display it? What is the
value in the variable?
Armin


我正在使用VB .Net 2003.


日期在文本框中输入并存储在

数据表中的列(日期数据类型)中,并进一步存储在SQL中服务器数据库(也是日期数据类型)。

我通过查询分析器检查并正确存储日期。所以,当我在另一台机器上显示该日期时,问题就出现了。


键入的日期是01/01/2006,尽管它发生在每一个约会我保存。


" Armin Zingler" < AZ ******* @ freenet.de>在消息中写道

news:um ************* @ TK2MSFTNGP12.phx.gbl ...
I''m using VB.Net 2003.

The date is typed in a textbox and stored in a column (date datatype) in a
datatable, and further stored in a SQL Server database (also date datatype).
I checked via Query Analyzer and the date is correctly stored. So, when I
show that date in another machine, the problem occurs.

The date typed is 01/01/2006, although it happens with every date I save.


"Armin Zingler" <az*******@freenet.de> wrote in message
news:um*************@TK2MSFTNGP12.phx.gbl...
" Cesar Ronchese" < ronchese_hotmail_dot_com> schrieb
"Cesar Ronchese" <ronchese_hotmail_dot_com> schrieb
你好!

我已经建立了一个程序,向用户显示一些日期。我遇到了一个问题
当用户有不同的配置时区机器时,其中:

- 一台机器确定显示日期的时区是
01/01/2006。 - 在其他不同的机器(和其他配置的时间区域)中,显示的日期是12/31/2006 19:00:00

如果我将这两台机器的时区重新定义为同样,
日期工作正常。

我认为:如果日期已注册为01/01/2006,则应显示为01/01/2006 ,独立于在CultureInfo类中修复它。或者我错了?

为什么会发生这种情况以及如何解决?
Hello!

I''ve built a program that show some dates to users. I got a problem
when users have different configured time zone machines, where:

- One machine that determined time zone the date displayed is
01/01/2006. - In other different machine (and other configured time
zone), the date displayed is 12/31/2006 19:00:00

If I redefine the time zones of these two machines to the same, the
date works fine.

I think this: if the date is registered as 01/01/2006, it should be
showed as 01/01/2006, independent of fix it in CultureInfo class. Or I''m
wrong?

Why does this happen and how to resolve it?



您使用的是哪个版本的VB? 2003年还是2005年?我问,因为DateTime现在
有一个属性''Kind''。除此之外:你从哪里获得DateTime?
你在哪里存储它(变量的类型)?你是如何展示它的?什么是变量中的值?

Armin


Which version of VB do you use? 2003 or 2005? I ask because DateTime now
has
a property ''Kind''. Apart from this: Where do you get the DateTime from?
Where do you store it (type of variable)? How do you display it? What is
the value in the variable?
Armin



" Cesar Ronchese" < ronchese_hotmail_dot_com> schrieb
"Cesar Ronchese" <ronchese_hotmail_dot_com> schrieb
我正在使用VB.Net 2003.

日期在文本框中输入并存储在数据表的列(日期
数据类型)中,并进一步存储在SQL Server数据库(也是日期数据类型)中。我通过查询分析器检查了
日期是否正确存储。因此,当我在另一台
机器上显示该日期时,会出现问题。

键入的日期是01/01/2006,尽管它会在我保存的每个日期发生。
I''m using VB.Net 2003.

The date is typed in a textbox and stored in a column (date
datatype) in a datatable, and further stored in a SQL Server
database (also date datatype). I checked via Query Analyzer and the
date is correctly stored. So, when I show that date in another
machine, the problem occurs.

The date typed is 01/01/2006, although it happens with every date I
save.



我很害怕,我不知道SQL服务器是否可以存储时区

信息以及日期。 ...根据文档,它不是。


如何在另一台机器上显示日期?我必须承认,目前,我还不知道(还)在从你的文本框到另一台机器的途中将时区信息考虑在内。

。 br />
Armin


I''m afraid, I don''t know whether the SQL server can store timezone
information along with the date. ... According to the docs, it doesn''t.

How do you display the date on the other machine? I must admit, currently, I
don''t know (yet) where timezone information is taken into account on the way
from your textbox to the other machine.
Armin


这篇关于日期和时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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