这个月过了几分钟 [英] How many minutes past this month
本文介绍了这个月过了几分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要这个功能告诉我本月到目前为止多少分钟。
解决方案
我想,这就是它...
DateDiff(DateInterval.Minute,CType(" 01 /"& Date.Now.Month&" /"&
Date.Now.Year,System.DateTime),Now())
" Jozef Jarosciak"写道:
我需要函数告诉我本月到目前为止多少分钟。
Dim minthismonth As Integer = DateDiff(DateInterval.Minute,
CType((" 01 /"& Date.Now.Month&" /"& Date.Now .Year),System.DateTime),
现在())
显示结果:272895
哪个不可能是事实。今天是15日,所以让它围绕它:
15(天)x 24(小时)x 60(分钟)= 21600分钟
结果不应该是272895 ,但是少于21600.
有人能看出这段代码有什么问题吗?
谢谢
Jozef Jarosciak
" Jozef Jarosciak" < jo*@doprocess.com>在消息新闻中写道:11 ********************* @ g43g2000cwa.googlegro ups.com ...Dim minthismonth As Integer = DateDiff(DateInterval.Minute,
CType((" 01 /"& Date.Now.Month&" &&;& Date.Now.Year),System.DateTime),>现在())
显示结果:272895
哪个不可能是事实。今天是15日,所以让它围绕它:
15(天)x 24(小时)x 60(分钟)= 21600分钟
结果不应该是272895,但是小于21600。有人能看出这段代码有什么问题吗?
谢谢
Jozef Jarosciak
看起来应该是:
CType((Date.Now.Month&" / 01 /"& Date.Now.Year),System.DateTime),Now())
这可能是从1月7日到现在计算的。
-
Al Reid
I need the function to tell me how many minutes past so far this month.
解决方案
i guess, this is it...
DateDiff(DateInterval.Minute, CType("01/" & Date.Now.Month & "/" &
Date.Now.Year, System.DateTime), Now())
"Jozef Jarosciak" wrote:
I need the function to tell me how many minutes past so far this month.
Dim minthismonth As Integer = DateDiff(DateInterval.Minute,
CType(("01/" & Date.Now.Month & "/" & Date.Now.Year), System.DateTime),
Now())
is showing result of : 272895
Which cannot be the truth. Today is 15th, so lets round it:
15(days) x 24(hours) x 60(minutes) = 21600 minutes
Result shouldnt be 272895, but little less than 21600.
Can someone see what is wrong with this code?
Thanks
Jozef Jarosciak
"Jozef Jarosciak" <jo*@doprocess.com> wrote in message news:11*********************@g43g2000cwa.googlegro ups.com...Dim minthismonth As Integer = DateDiff(DateInterval.Minute,
CType(("01/" & Date.Now.Month & "/" & Date.Now.Year), System.DateTime),
Now())
is showing result of : 272895
Which cannot be the truth. Today is 15th, so lets round it:
15(days) x 24(hours) x 60(minutes) = 21600 minutes
Result shouldnt be 272895, but little less than 21600.
Can someone see what is wrong with this code?
Thanks
Jozef Jarosciak
Looks like it should have been:
CType((Date.Now.Month & "/01/" & Date.Now.Year), System.DateTime), Now())
It was probably calculating from January 7th to now.
--
Al Reid
这篇关于这个月过了几分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文