473,728 Members | 1,612 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 12506
Abs wrote on 13 mrt 2007 in microsoft.publi c.inetserver.as p.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,n owGMT)
If nowGMT>#2007-10-28 01:00# Then nowCET = DateAdd("h",1,n owGMT)
If nowGMT>#2008-03-30 01:00# Then nowCET = DateAdd("h",2,n owGMT)
If nowGMT>#2008-10-26 01:00# Then nowCET = DateAdd("h",1,n owGMT)
%>

<script language='javas cript' runat='server'>
var TimezoneOffset = new Date().getTimez oneOffset()/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**********@e mail.comwrote in message news:%2******** ********@TK2MSF TNGP03.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.publi c.inetserver.as p.general:
"Abs" <no**********@e mail.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=javasc ript>
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.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
Jon Paal [MSMD] wrote on 14 mrt 2007 in
microsoft.publi c.inetserver.as p.general:
>"Abs" <no**********@e mail.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=javasc ript>
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
3151
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 tested timer functions capabilities with a short script: import time import os
6
3750
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 speed things up implementing some of the functions in C. So I need profiling. I first tried to use the default python profiler, but profiling my application multiplies the execution time by a factor between 10 and 100 ! So I decided to give a...
6
2851
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 across the country. txtRaceTime will always be set to Central Time regardless of where we are in the US. At first I tried ‘Now() – “xx:xx:xx” but that produced an error. Anyway as we approach the east coast the ‘minus’ would need to be a...
3
2721
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 me and write in easier terms I would be very gratefull to all you access wizards! Here is my problem. I have a table with maybe 10 fields, It is used to imput information taken over the phone to solve patient problems in our Spanish...
0
1910
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 events in the Object Inspector, the equivalent to the VS .NET Windows form designer. The run-time DLL would only contain the code necessary at run-time. The design time DLL referenced the run-time DLL, but not vice-versa. This allowed the run-time...
1
3601
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, then the compiler (VC7.1) barfed up this lot: c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\time.h(156) : error C2143: syntax error : missing ',' before '*' c:\Program Files\Microsoft Visual Studio .NET
3
2029
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 to be able to do comparisons on them.
6
12546
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 calendar control to allow my users to enter a date but I need them to enter a time as well. It doesn't look like the calendar control will allow times to be entered so I was thinking of having two text boxes. One text box would contain the date...
1
14595
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 = '2007-03-13T15:00:00Z' I want to convert it to my local time. start_time = time.mktime(time.strptime(start_time, '%Y-%m-%dT%H:%M:
2
19583
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' *********************** Starting new log output
0
8757
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9272
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9196
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6013
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4524
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3235
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 we have to send another system
2
2651
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2160
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.