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
But I want to know the equivalent in classic asp. Thanks
According to u229.no, there isn't any built-in way in VBScript to convert to UTC.
Take a look at the code the author provided below which uses JScript, and how you can call this from VBScript.
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
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;
%>
There are other jscript methods that you can use as well.