473,236 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 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 11726
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Drunkalot | last post by:
How can I set the system time using a DateTime object??? s...
0
by: Bill Borg | last post by:
Hello all, I need to know the local time for users of a global system. Here's the scenario: My server (PDT time) hosts commerce for companies around the world. It's fair to assume that those...
5
by: ECVerify.com | last post by:
I am trying to convert a computers local time to Pacific time, I can get it back to UTC pretty easy but I actually want to convert whatever the local time is on the computer I want to calculate...
3
by: Randall Parker | last post by:
Suppose one has a database of UTC times that are from different dates in the past. The problem with translating those times to a local time is that one does not know for each UTC time whether the...
5
by: Nathan Sokalski | last post by:
I asked a question about a week ago about how to get my local time, since my application is running on a server halfway around the world. I have determined that my code would look something like...
3
by: activeashish | last post by:
my present MYSQL server is storing current time not as an indian time can any one help me in converting this time to indian time either through php or mysql
1
by: dusty | last post by:
I am trying to convert a gmt time which is like 23:00:00 to local time 10:00:00 and even get the time diff that's the offset along with it in c++. Can anyone help me out with this. Thanks a lot in...
1
by: davelist | last post by:
I'm guessing there is an easy way to do this but I keep going around in circles in the documentation. I have a time stamp that looks like this (corresponding to UTC time): start_time =...
2
by: ZR | last post by:
Hello, I need to convert a GMT time string to local time. I can fill out a "tm" structure with the GMT time string. Are there any standard C (or OS) time functions that will allow me to do this? ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.