ASP time in GMT

A

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
 
E

Evertjan.

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].
 
E

Evertjan.

Jon Paal [MSMD] wrote on 14 mrt 2007 in
microsoft.public.inetserver.asp.general:

[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>
============================
 
A

Abs

Thanks guys, probably use javascript.

Evertjan. said:
Jon Paal [MSMD] wrote on 14 mrt 2007 in
microsoft.public.inetserver.asp.general:

[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>
============================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top