469,327 Members | 1,347 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

Converting local time to UTC

Hi All

1. I need to convert the local-time of the server on which I run my website
to UTC and I don't want to rely on the server local time and timezone (i.e.
I don't want to hardcode the timezone information), is there a generic way
to do this?
2. Is there a general for converting time between timezones in ASP?

Many thanks

Elie Grouchko
Jul 22 '05 #1
4 11016
Elie Grouchko wrote on 13 nov 2004 in
microsoft.public.inetserver.asp.general:
1. I need to convert the local-time of the server on which I run my
website to UTC and I don't want to rely on the server local time and
timezone (i.e. I don't want to hardcode the timezone information), is
there a generic way to do this?


Use an ASP jscript function:

<%
'' vbscript:
response.write currentUTC()
%>

<script language=jscript runat=server>
function currentUTC(){
var d, s;
d = new Date();
s = "Server current UTC time is: ";
s += d.toUTCString();
return(s);
}
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 22 '05 #2
This relies on the client's computer time being correct, I'm looking for a
solution that doesn't rely on the client settings.
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Elie Grouchko wrote on 13 nov 2004 in
microsoft.public.inetserver.asp.general:
1. I need to convert the local-time of the server on which I run my
website to UTC and I don't want to rely on the server local time and
timezone (i.e. I don't want to hardcode the timezone information), is
there a generic way to do this?


Use an ASP jscript function:

<%
'' vbscript:
response.write currentUTC()
%>

<script language=jscript runat=server>
function currentUTC(){
var d, s;
d = new Date();
s = "Server current UTC time is: ";
s += d.toUTCString();
return(s);
}
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 22 '05 #3
Elie Grouchko wrote on 13 nov 2004 in
microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
Elie Grouchko wrote on 13 nov 2004 in
microsoft.public.inetserver.asp.general:
> 1. I need to convert the local-time of the server on which I run my
> website to UTC and I don't want to rely on the server local time
> and timezone (i.e. I don't want to hardcode the timezone
> information), is there a generic way to do this?
>


Use an ASP jscript function:

<%
'' vbscript:
response.write currentUTC()
%>

<script language=jscript runat=server>
function currentUTC(){
var d, s;
d = new Date();
s = "Server current UTC time is: ";
s += d.toUTCString();
return(s);
}
</script>

This relies on the client's computer time being correct, I'm looking
for a solution that doesn't rely on the client settings.


[topposting corrected]

No, you are wrong, Elie.

The above is totally serverside code,
no clientside code or clock is involved.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 22 '05 #4
Hi

Sorry, my mistake :)
"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn*******************@194.109.133.29...
Elie Grouchko wrote on 13 nov 2004 in
microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message
Elie Grouchko wrote on 13 nov 2004 in
microsoft.public.inetserver.asp.general:

> 1. I need to convert the local-time of the server on which I run my
> website to UTC and I don't want to rely on the server local time
> and timezone (i.e. I don't want to hardcode the timezone
> information), is there a generic way to do this?
>

Use an ASP jscript function:

<%
'' vbscript:
response.write currentUTC()
%>

<script language=jscript runat=server>
function currentUTC(){
var d, s;
d = new Date();
s = "Server current UTC time is: ";
s += d.toUTCString();
return(s);
}
</script>

This relies on the client's computer time being correct, I'm looking
for a solution that doesn't rely on the client settings.


[topposting corrected]

No, you are wrong, Elie.

The above is totally serverside code,
no clientside code or clock is involved.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Drunkalot | last post: by
reply views Thread by Bill Borg | last post: by
5 posts views Thread by ECVerify.com | last post: by
3 posts views Thread by Randall Parker | last post: by
5 posts views Thread by Nathan Sokalski | last post: by
1 post views Thread by davelist | last post: by
2 posts views Thread by ZR | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
reply views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.