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日")
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日")