// 返回当前时间函数
public string GetDateTime()
{
try // 正常运行
{
String strDateTime = null;
// 获得当前系统日期时间(数字)
strDateTime = DateTime.Now.Date.Year.ToString();
strDateTime += DateTime.Now.Date.Month.ToString();
strDateTime += DateTime.Now.Date.Day.ToString();
strDateTime += DateTime.Now.Hour.ToString();
strDateTime += DateTime.Now.Minute.ToString();
strDateTime += DateTime.Now.Second.ToString();
// 返回当前时间
return strDateTime;
catch // 异常处理
{
}
}
public string GetDateTime()
{
try // 正常运行
{
String strDateTime = null;
// 获得当前系统日期时间(数字)
strDateTime = DateTime.Now.Date.Year.ToString();
strDateTime += DateTime.Now.Date.Month.ToString();
strDateTime += DateTime.Now.Date.Day.ToString();
strDateTime += DateTime.Now.Hour.ToString();
strDateTime += DateTime.Now.Minute.ToString();
strDateTime += DateTime.Now.Second.ToString();
// 返回当前时间
return strDateTime;
catch // 异常处理
{
}
}