你如何将Datetime.UTCnow.Hour转换为双倍? [英] How do you convert Datetime.UTCnow.Hour to a double?
本文介绍了你如何将Datetime.UTCnow.Hour转换为双倍?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你如何兑换
Datetime.UTCnow.Hour
加倍?
UTChour = Cdbl(Datetime.UTCnow.Hour)
UTChour = Cdbl(Datetime.UTCnow.ToString(HH))< br $>
不起作用。
How do you convert
Datetime.UTCnow.Hour
to a double?
UTChour = Cdbl(Datetime.UTCnow.Hour)
UTChour = Cdbl(Datetime.UTCnow.ToString("HH"))
do not work.
推荐答案
它应该 - UTCNow返回一个标准的DateTime,而Hour只返回一个整数 - 所以CDbl只会将int32
转换为double
值。
和a快速查看:
It should - UTCNow returns a standard DateTime, and Hour just returns an integer - so CDbl will just convert theint32
to adouble
value.
And a quick check here:
Dim d As Double = CDbl(DateTime.UtcNow.Hour)
说工作正常...... d
包含18.0,而它是19:26 BST,即GMT + 1或UTC + 1如果您愿意......
Says it works just fine...d
contains 18.0, and it's 19:26 BST, which is GMT+1, or UTC+1 if you prefer...
这篇关于你如何将Datetime.UTCnow.Hour转换为双倍?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文