在传统的ASP当前世界时间 [英] Current Universal time in classic asp
问题描述
我怎样才能获得当前时间作为通用的时间传统的ASP。我知道如何在C#中得到,我得到在C#中通用的时间与以下行((DateTime.Now).ToUniversalTime())。的ToString(S),这code给我时间这样2012- 07-09T10:29:49
How can I get the current time as Universal time in classic asp. I know how to get in C# and I am getting the universal time in c# with following line ((DateTime.Now).ToUniversalTime()).ToString("s") and this code gives me time like this 2012-07-09T10:29:49
不过,我想知道在传统的ASP的等价物。谢谢
But I want to know the equivalent in classic asp. Thanks
推荐答案
根据 u229。没有,没有任何方式ASP经典转换为UTC。
According to u229.no, there isn't any way for ASP Classic to convert to UTC.
看看在code下面提供的作者。
Take a look at the code the author provided below.
该GetServerGMT程序将返回类似:周三,2006年02月01日15时21分59秒UTC
The GetServerGMT routine will return something like: Wed, 01 Feb 2006 15:21:59 UTC.
Function GetServerGMT()
// Use JScript to get the current GMT time stamp and store it in Session("ServerGMT")
Server.Execute "GetServerGMT.asp"
GetServerGMT = Session("ServerGMT")
End Function
这是与JScript的code中的GetServerGMT.asp文件的样子:
And this is how the GetServerGMT.asp file with the jscript code looks like:
<%@language="jscript"%>
<%
var od = new Date();
var nd = od.toUTCString();
Session("ServerGMT") = nd;
%>
有其他的JScript 的方法,您可以使用为好。
There are other jscript methods that you can use as well.
这篇关于在传统的ASP当前世界时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!