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

时间:2022-06-01 16:49:41
代码如下:

<%@ 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) 
%>