日期:2014-05-16 浏览次数:20984 次
<%
function getDatetime(str)
dim re,a
set re = new regexp
re.pattern = "\d{4}([/-])\d{1,2}\1\d{1,2}(?: \d{1,2}:\d{1,2}:\d{1,2})?"
if re.test(str) then
a = re.execute(str)(0)
if isdate(a) then
a = cdate(a)
getDatetime = a
end if
end if
end function
response.write getDatetime("2013-12-31 18:43:00 PingWest 书上")
response.write "<br>"
response.write getDatetime("2013/12/31 18:43:00 PingWest 书上")
response.write "<br>"
response.write getDatetime("2013-12-39 18:43:00 PingWest 书上")
response.write "<br>"
response.write getDatetime("2013-12-31 PingWest 书上")
response.write "<br>"
%>