字符串是否是时间格式
2017-01-25 17:24:34 访问(1482) 赞(0) 踩(0)
/// <summary>
/// 字符串是否是时间格式
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public bool StrIsDateTime(string str)
{
if (str == null)
return false;
if (str.Length == 0)
return false;
str = str.Trim();
if (str.Length == 0)
return false;
DateTime theValue = DateTime.MinValue;
return DateTime.TryParse(str, out theValue);
}
标签:
字符串是否是时间格式 


上一条:
下一条:
相关评论
发表评论