在 VB.NET 中获取当前时间
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36188741/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Getting the current hour's in VB.NET
提问by Danny
I'm writing a program in VB.NET that needs to get the current time.
Does anybody know of a method that will do that?
我正在 VB.NET 中编写一个需要获取当前时间的程序。
有人知道可以做到这一点的方法吗?
回答by Danny
When I tried Plutonix's code Dim thisHour = DateTime.Now.TimeofDay.Hours
I found this code while typing TimeOfDayTimeOfDay.Hourfor Hour. TimeOfDay.Minutefor Minute. TimeOfDay.Secondfor Second
And I'm very happy, thank you Plutonix
当我尝试 Plutonix 的代码时,Dim thisHour = DateTime.Now.TimeofDay.Hours
我在输入TimeOfDayTimeOfDay.HourHour 时发现了这段代码。TimeOfDay.Minute分钟。TimeOfDay.Second对于第二
我很高兴,谢谢 Plutonix
回答by Hirbod Behnam
Simple:
简单的:
DateTime.Now.TimeofDay.Hours

