471,854 Members | 1,525 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,854 software developers and data experts.

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 11421
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
reply views Thread by YellowAndGreen | last post: by
aboka
reply views Thread by aboka | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.