如何创建一个DateTime对象? [英] How to create a DateTime object?
本文介绍了如何创建一个DateTime对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有三个整数:时,分和秒
I have three integers: Hours, Minutes, and Seconds.
我要创建System.Date和时间的DateTime
对象由上述三个变量提供的。
I want to create a DateTime
object with System.Date and Time provided by the above three variables.
推荐答案
查阅MSDN,有一个看的构造存在的的DateTime
,你会发现,这是可能的:
Check out MSDN and have a look at the constructors that exists for DateTime
, you'll find out that this is possible:
var theDate = new DateTime (DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, hours, minute, second);
这篇关于如何创建一个DateTime对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文