分隔日期和时间 [英] Separating Date and Time

查看:127
本文介绍了分隔日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写代码以将时间和日期分隔到C#Windows窗体应用程序中.请帮助我

How to code to separate the time and date to C# windows form application. Please help me

推荐答案

使用DateTime类获取日期时间.根据需要解析或格式化.它具有许多内置的方法和属性
Use a DateTime class to get the date time. Parse or Format as needed. It has lot of built-in methods and properties


似乎这个问题已经在bAdzzzz相似的另一个线程中得到了回答:

http://www.codeproject.com/Questions/112008/separate-date-and- time.aspx [ ^ ]
Seems like this question has already been answered in another thread started by a bAdzzzz look-alike:

http://www.codeproject.com/Questions/112008/separate-date-and-time.aspx[^]


DateTime dt = DateTime.Now;  // for example
DateTime date = dt.Date;
TimeSpan time = dt.TimeOfDay;

享受!


这篇关于分隔日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆