asp获取服务器时间
asp获取服务器时间??
------解决方案--------------------是指运行asp的服务器时间吗,用Now就可以了
------解决方案-------------------- <html>
<head>
<script language=javascript type= "text/javascript ">
var secondServer = <%=DateDiff( "s ", "1970-01-01 08:00:00 ", Now())%> ;
var secondClient = parseInt(new Date().getTime()/1000);
var secondSub = secondServer - secondClient;
function meizzTime(n)
{
var mei = new Date();
mei.setTime(mei.getTime() + n*1000);
var h = (mei.getHours() > 9) ? mei.getHours() : "0 " + mei.getHours();
var m = (mei.getMinutes() > 9) ? mei.getMinutes() : "0 " + mei.getMinutes();
var s = (mei.getSeconds() > 9) ? mei.getSeconds() : "0 " + mei.getSeconds();
document.meizz.clock.value = "【 "+ h + ": "+ m + ": "+ s + "】 ";
setTimeout( "meizzTime(secondSub) ", 1000);
}
</script>
<meta http-equiv= 'Content-Type ' content= 'text/html; charset=gb2312 '>
<meta http-equiv= "refresh " content= "1000 ">
<title> 显示服务器时间 </title>
</head>
<body onLoad= "meizzTime(secondSub) ">
<form name= "meizz ">
<input name= "clock " size= "12 ">
</form>
</body>
</html>
上面这个是显示服务器时间的,,,有问题再找我
------解决方案--------------------完整的年月日时分秒
now()
年月日 date()
时分秒 time()
------解决方案--------------------- -
<%
dim nowtime,sql,rs
sql= "select getdate() as 当前时间 "
set rs=server.createobject( "adodb.recordset ")
rs.open sql,conn,1,1
nowtime=rs( "当前时间 ")
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write nowtime
%>