这种日期格式可以用什么方法提取出来?

Mapleleaf123 2013-12-30 06:39:52

这里可能有空格2012-12-30 17:22:00 这里有中文数字英文空格TAB键等

要取出2012-12-30 17:22:00有什么方法吗

...全文
212 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
_拙计 2013-12-31
  • 打赏
  • 举报
回复
正则表达式过滤下就好了吧
001007009 2013-12-31
  • 打赏
  • 举报
回复
<%
	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>"
%>
试试
Anlige 2013-12-31
  • 打赏
  • 举报
回复
正则表达式 日期:"(\d{4})\-(\d{1,2})\-(\d{1,2})" 时间:"(\d{1,2})\:(\d{1,2})\:(\d{1,2})"
Mapleleaf123 2013-12-31
  • 打赏
  • 举报
回复
其实这个就是采集回来的数据要处理一下,那个日期就是采集的文章的发布日期 如“2013-12-30 18:43:00  PingWest  书上”要结果是:2013-12-30 18:43:00 “ 2013-12-30  青年创业网”结果是:2013-12-30
xdfd 2013-12-31
  • 打赏
  • 举报
回复
在数据库里定义格式并用Now()获取就OK 很简单的
chinaurls 2013-12-30
  • 打赏
  • 举报
回复
没太懂你的意思,最好给个演示结果,然后给个过滤后的结果

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧