时间比较?应该很简单 [英] time compare? should be simple

查看:70
本文介绍了时间比较?应该很简单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个datetimepicker只是时间格式化,用户选择时间。

如果那个时间是午夜到早上8点我想比较

dtmTime#11 :59:59 PM#和dtmTime< #08:00:00 AM#


当时间不超过时评估为真


dtmTime#9:32:34下午#


为什么?我怎样才能让它工作?

Brian

I have a datetimepicker formated for just time, the user selects the time.
I want to compare if that time is between midnight and 8 am
dtmTime #11:59:59 PM# and dtmTime < #08:00:00 AM#

this evaluates to true when the time is not greater than

dtmTime #9:32:34 PM#

Why is that? and How can I get this to work?
Brian

推荐答案

Brian,


也许更简单(至少对我而言,不是来自英语

文化的人),使用New Datetime。


dim a(作为旧版本的DateTime)= new DateTime(now.Year,now.Month,

现在,Day,8,0,0)


如果是<现在它落后于8 o''clcok


Cor


" Brian" < bs ******** @ community.nospamschreef在bericht

新闻:Oi ************** @ TK2MSFTNGP04.phx.gbl .. 。
Brian,

Maybe it is more simple (at least for me, not somebody from an English
culture), to use New Datetime.

dim a (as DateTime for older versions) = new DateTime(now.Year,now.Month,
Now,Day,8,0,0)

If a < Now then it is behind 8 o''clcok

Cor

"Brian" <bs********@community.nospamschreef in bericht
news:Oi**************@TK2MSFTNGP04.phx.gbl...

>我有一个datetimepicker只是时间格式化,用户选择时间。

我想比较,如果那个时间是午夜至早上8点之间

dtm时间#11:59:59 PM#和dtmTime< #08:00:00 AM#


当时间不超过时评估为真


dtmTime#9:32:34下午#


为什么?我怎样才能让它工作?

Brian

>I have a datetimepicker formated for just time, the user selects the time.
I want to compare if that time is between midnight and 8 am
dtmTime #11:59:59 PM# and dtmTime < #08:00:00 AM#

this evaluates to true when the time is not greater than

dtmTime #9:32:34 PM#

Why is that? and How can I get this to work?
Brian



不确定你是什么意思是那里..我把dtmTime定义为日期时间

以及我什么时候对它进行操作..是

#11/5/2008 9:44:07 PM#但在我之前发布的代码中...这是评估到午夜的价值



" Cor Ligthert [MVP]" < no ************ @ planet.nlwrote in message

news:O3 ************** @ TK2MSFTNGP04.phx .gbl ...
not really sure what you mean there.. I have dtmTime defined as datetime
and when I do immed on it.. is
#11/5/2008 9:44:07 PM# but in my code posted previously... this was
evaluating to than midnight

"Cor Ligthert[MVP]" <no************@planet.nlwrote in message
news:O3**************@TK2MSFTNGP04.phx.gbl...

Brian,


也许它更简单(至少对我来说,不是来自某个人)英语

culture),使用New Datetime。


dim a(作为旧版本的DateTime)= new DateTime(now.Year,now.Month,

现在,Day,8,0,0)


如果a<现在它落后于8 o''clcok


Cor


" Brian" < bs ******** @ community.nospamschreef在bericht

新闻:Oi ************** @ TK2MSFTNGP04.phx.gbl .. 。
Brian,

Maybe it is more simple (at least for me, not somebody from an English
culture), to use New Datetime.

dim a (as DateTime for older versions) = new DateTime(now.Year,now.Month,
Now,Day,8,0,0)

If a < Now then it is behind 8 o''clcok

Cor

"Brian" <bs********@community.nospamschreef in bericht
news:Oi**************@TK2MSFTNGP04.phx.gbl...

>>我有一个datetimepicker只用时间格式化,用户选择时间。
我想比较一下这个时间是否在午夜之间和上午8点
dtmTime#11:59:59 PM#和dtmTime< #08:00:00 AM#

当时间不超过时,评估为真。

dtmTime#9:32:34 PM#

为什么?我怎样才能让它工作?
Brian

>>I have a datetimepicker formated for just time, the user selects the time.
I want to compare if that time is between midnight and 8 am
dtmTime #11:59:59 PM# and dtmTime < #08:00:00 AM#

this evaluates to true when the time is not greater than

dtmTime #9:32:34 PM#

Why is that? and How can I get this to work?
Brian




" ;布赖恩" < bs ******** @ community.nospamschrieb
"Brian" <bs********@community.nospamschrieb

不太确定你的意思..我把dtmTime定义为datetime

,当我确实对它进行了..是

#11 / 5/2008 9:44:07 PM#但在我之前发布的代码中......这是

评估到午夜
not really sure what you mean there.. I have dtmTime defined as datetime
and when I do immed on it.. is
#11/5/2008 9:44:07 PM# but in my code posted previously... this was
evaluating to than midnight



一切都不是午夜?

尝试仅比较TimeOfDay(YourDateTimePicker.Value。 TimeOfDay)

Armin


Isn''t everything than midnight?
Try comparing the TimeOfDay only (YourDateTimePicker.Value.TimeOfDay)
Armin


这篇关于时间比较?应该很简单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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