知识点 词汇表 联系我们
按类别浏览
内容搜索    
当前位置:WEB开发技术知识库(www.cn-web.com) .: .Net技术 .: .Net代码库 .: 检测字符串是否为日期

检测字符串是否为日期

public bool CheckIsDate(string p_strDate)
{
    Regex Pattern=new Regex("(\\d{4}-)?[0-1]?\\d{1}-[0-3]?\\d{1}");    
    return Pattern.IsMatch(p_strDate) ;
}

对此文章打分评级

用户评论

增加评论
Comment ? <
Warning: Smarty error: mailto: hex encoding does not work with extra attributes. Try javascript. in /web/c/cn-web.com/third_party/smarty/libs/Smarty.class.php on line 1102
>
12-15-2007 at 10:28am

?
?
Comment nece001 <nece001@163.com>
12-15-2007 at 10:29am

另类用法
public static bool IsDate(object val)
{
try
{
Convert.ToDateTime(val);
return true;
}
catch
{
return false;
}
}
网站地图 - 知识词汇 - 全文检索 - 广告服务 - 帮助中心 - 联系我们
.:www.cn-web.com
网站技术开发联盟之WEB开发技术知识库
联系人:老韩(QQ:5679551)
晋ICP备07003487号