首页  编辑  

自定义时间格式转换

Tags: /C#/日期时间/   Date Created:

string s = "20070419090909" ;

DateTime vDateTime;

if ( DateTime . TryParseExact(s, "yyyyMMddHHmmss" , null ,

   System . Globalization . DateTimeStyles . None, out vDateTime))

    MessageBox . Show(vDateTime . ToString());

else MessageBox . Show( " );