473,507 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP time in GMT

Abs
Hello,

I've used this ASP funtion to display the time on my web page:

Date: <%= FormatDateTime(Date, 1)%>
Time: <%= FormatDateTime(now, 4)%>

THis was working fine until i moved my site to a server based in the states,
not the time is 5hrs behind. Can anyone help me resolve this??

Many thanks.

Abs
Mar 13 '07 #1
5 12485
Abs wrote on 13 mrt 2007 in microsoft.public.inetserver.asp.general:
Hello,

I've used this ASP funtion to display the time on my web page:

Date: <%= FormatDateTime(Date, 1)%>
Time: <%= FormatDateTime(now, 4)%>

THis was working fine until i moved my site to a server based in the
states, not the time is 5hrs behind. Can anyone help me resolve
this??
It would be usefull if you told us your timezone!

This topic was posted by me yesterday in his NG,

The server being in Toronto [Now],
the result in Central European Time [nowCET].
==================================
<%
nowGMT = DateAdd("h", TimezoneOffset, Now)
nowCET = DateAdd("h", 1, nowGMT)
If nowGMT>#2007-03-25 01:00# Then nowCET = DateAdd("h",2,nowGMT)
If nowGMT>#2007-10-28 01:00# Then nowCET = DateAdd("h",1,nowGMT)
If nowGMT>#2008-03-30 01:00# Then nowCET = DateAdd("h",2,nowGMT)
If nowGMT>#2008-10-26 01:00# Then nowCET = DateAdd("h",1,nowGMT)
%>

<script language='javascript' runat='server'>
var TimezoneOffset = new Date().getTimezoneOffset()/60;
</script>
===========================================
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 13 '07 #2
Abs wrote:
Hello,

I've used this ASP funtion to display the time on my web page:

Date: <%= FormatDateTime(Date, 1)%>
Time: <%= FormatDateTime(now, 4)%>

THis was working fine until i moved my site to a server based in the states,
not the time is 5hrs behind. Can anyone help me resolve this??

Many thanks.

Abs

http://classicasp.aspfaq.com/date-ti...-gmt-time.html
Mike
Mar 13 '07 #3
ASP runs on the server and will return server time. If you want local time of the user to be displayed on the page you can use
client side javascript .

"Abs" <no**********@email.comwrote in message news:%2****************@TK2MSFTNGP03.phx.gbl...
Hello,

I've used this ASP funtion to display the time on my web page:

Date: <%= FormatDateTime(Date, 1)%>
Time: <%= FormatDateTime(now, 4)%>

THis was working fine until i moved my site to a server based in the states, not the time is 5hrs behind. Can anyone help me
resolve this??

Many thanks.

Abs

Mar 14 '07 #4
Jon Paal [MSMD] wrote on 14 mrt 2007 in
microsoft.public.inetserver.asp.general:
"Abs" <no**********@email.comwrote in message
>THis was working fine until i moved my site to a server based in the
states, not the time is 5hrs behind. Can anyone help me resolve
this??
[Please do not toppost on usenet]
ASP runs on the server and will return server time. If you want local
time of the user to be displayed on the page you can use client side
javascript .
However, it is quite possible to add
trusted [ ;-) ] serverside time precision to that:

==========================
<script runat=server language=javascript>
var ds = new Date();
ds = ds*1;
</script>

<script type='text/javascript'>

var ds = <% =ds %>; // numerical UTC server
var dc = new Date();
dc = dc*1; // numerical UTC client
var dif = ds-dc; // millisecs UTC difference
dif2 = Math.floor(-dif/1000)

document.write("Local clock error: " + dif2 + " sec.<br><br>");

d = new Date()

document.write("Client time being: " + d + "<br><br>");

d = new Date(d*1+dif);

document.write("Exact local time being: " + d );

</script>
============================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 14 '07 #5
Abs
Thanks guys, probably use javascript.

"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
Jon Paal [MSMD] wrote on 14 mrt 2007 in
microsoft.public.inetserver.asp.general:
>"Abs" <no**********@email.comwrote in message
>>THis was working fine until i moved my site to a server based in the
states, not the time is 5hrs behind. Can anyone help me resolve
this??

[Please do not toppost on usenet]
>ASP runs on the server and will return server time. If you want local
time of the user to be displayed on the page you can use client side
javascript .

However, it is quite possible to add
trusted [ ;-) ] serverside time precision to that:

==========================
<script runat=server language=javascript>
var ds = new Date();
ds = ds*1;
</script>

<script type='text/javascript'>

var ds = <% =ds %>; // numerical UTC server
var dc = new Date();
dc = dc*1; // numerical UTC client
var dif = ds-dc; // millisecs UTC difference
dif2 = Math.floor(-dif/1000)

document.write("Local clock error: " + dif2 + " sec.<br><br>");

d = new Date()

document.write("Client time being: " + d + "<br><br>");

d = new Date(d*1+dif);

document.write("Exact local time being: " + d );

</script>
============================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Mar 14 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3136
by: Szabolcs Nagy | last post by:
I have to measure the time of a while loop, but with time.clock i always get 0.0s, although python manual sais: "this is the function to use for benchmarking Python or timing algorithms" So i...
6
3736
by: cournape | last post by:
Hi there, I have some scientific application written in python. There is a good deal of list processing, but also some "simple" computation such as basic linear algebra involved. I would like to...
6
2833
by: Rebecca Smith | last post by:
Today’s question involves two time text boxes each set to a different time zone. Initially txtCurrentTime will be set to Pacific Time or system time. This will change with system time as we travel...
3
2679
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
0
1888
by: Edward Diener | last post by:
In Borland's VCL it was possible to divide a component into design time and run time DLLs. The design time DLL would only be necessary when the programmer was setting a component's properties or...
1
3573
by: Alfonso Morra | last post by:
Hi I'm compiling some code and need to generate some random numbers. To save time, I decided to use the srand, rand and time functions. My code worked (atleast built fine) until I added time.h,...
3
2013
by: cj | last post by:
If I want to check to see if it's after "11:36 pm" what would I write? I'm sure it's easy but I'm getting tired of having to work with dates and times. Sometimes I just want time or date. And...
6
12524
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
1
14578
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
19566
by: Roseanne | last post by:
We are experiencing very slow response time in our web app. We run IIS 6 - windows 2003. I ran iisstate. Here's what I got. Any ideas?? Opened log file 'F:\iisstate\output\IISState-812.log'...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7114
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7034
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1544
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.