我有一个的DateTime
例如,有一个日期和时间。
我如何只提取日期或只是时间?
VAR天= value.Date; //日期时间,这将只是整个天
VAR时间= value.TimeOfDay; //时间跨度是持续时间到天
I have a DateTime
instance that has a Date and a Time.
How do I extract only the date or only the time?
var day = value.Date; // a DateTime that will just be whole days
var time = value.TimeOfDay; // a TimeSpan that is the duration into the day