您的位置:首页 > 编程语言 > C#

C#提取系统时间

2011-12-25 16:49 127 查看
法1

 System.DateTime currentTime = new System.DateTime();    //定义

 currentTime = System.DateTime.Now;                     //取当年的日月时分秒

 string strY = currentTime.ToString("f");                    //不显示秒

法2

string strY = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm");

或string strY=DateTime.Now.ToString("yyyy年MM月dd日")
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c# string