当前位置: 移动技术网 > IT编程>开发语言>Asp > asp怎么获取毫秒数实现代码

asp怎么获取毫秒数实现代码

2017年12月08日  | 移动技术网IT编程  | 我要评论
复制代码 代码如下:

<%@ language=vbscript %><%response.expires =0 %>
<doctype html public='-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd'>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
</meta>
<title>
测试毫秒
</title>
</head>
<body>
<script runat="server" language="jscript">
var d = new date();
session("ms") = d.getmilliseconds();
response.write(session("ms"))
</script>
<br>
<%=session("ms")%>
</body>
</html>
以下代码得到17位的当前时间
如:20091210105237238=2009年12月10日10:52:37:238
<script runat="server" language="jscript">
var d = new date();
session("ms") = d.getmilliseconds();
</script>
<%
'得到年月日20090101格式
id=year(now())&right(month(now())+100,2)&right(day(now())+100,2)
'得到时间010101格式
id=id&right(replace(time(),":","")+1000000,6)
'得到3位数的毫秒
id=id&right(session("ms")+1000,3)
response.write(id)
%>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网