473,508 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

displaying the time

Hi Gurus

Is it possible to display the time on a site using javascript. I want to
show visitors the current time in New Zealand, but the javascript that I use
actually displays the time on the users computer (i.e. completely useless).

Any ideas greatly appreciated

Thanks in advance

- Nicolaas
Jul 23 '05 #1
7 1577
On Tue, 5 Oct 2004 11:49:10 +1300, WindAndWaves <ac****@ngaru.com> wrote:
Is it possible to display the time on a site using javascript. I want
to show visitors the current time in New Zealand, but the javascript
that I use actually displays the time on the users computer (i.e.
completely useless).


You can get UTC (GMT) time using the various UTC Date methods and adjust
the result with the appropriate offset. However, that depends on the
accuracy of the user's computer, so it might be just as useless.

You could always link to
<URL:http://www.worldtimeserver.com/?locationid=NZ>. I don't know exactly
how accurate they are.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
"Michael Winter" <M.******@blueyonder.co.invalid> wrote in message
news:opsfd0f5iix13kvk@atlantis...
On Tue, 5 Oct 2004 11:49:10 +1300, WindAndWaves <ac****@ngaru.com> wrote:
Is it possible to display the time on a site using javascript. I want
to show visitors the current time in New Zealand, but the javascript
that I use actually displays the time on the users computer (i.e.
completely useless).


You can get UTC (GMT) time using the various UTC Date methods and adjust
the result with the appropriate offset. However, that depends on the
accuracy of the user's computer, so it might be just as useless.

You could always link to
<URL:http://www.worldtimeserver.com/?locationid=NZ>. I don't know exactly
how accurate they are.

Hi Mike

I think I am going to use that link and perhaps see if I can use PHP instead
of Java. That client-side really is not useful here. Thank you for that
link though, that is great. I actually downloaded the program that they
offer there to keep your clock up-to-date, as my clock does not seem to keep
up.

Thank you

Nicolaas
Jul 23 '05 #3
JRS: In article <mi*******************@news.xtra.co.nz>, dated Tue,
5 Oct 2004 11:49:10, seen in news:comp.lang.javascript, WindAndWaves
<ac****@ngaru.com> posted :

Is it possible to display the time on a site using javascript. I want to
show visitors the current time in New Zealand, but the javascript that I use
actually displays the time on the users computer (i.e. completely useless).


Read the newsgroup FAQ, posted here regularly and via sig line 2.
With care, that will lead you to <URL:http://www.merlyn.demon.co.uk/
js-date5.htm#Demo> ; select the fourth entry in the drop-down, then
Run. Check the TZ string.

Or enter Wellington NZST-12NZDT,M10.1.0/2:00,M3.3.0/2:00 as a
line in <URL:http://www.merlyn.demon.co.uk/js-date5.htm#SLHD>

Check the change dates & times.

RSVP any corrections.

The code can be simplified for a specific case, but then you are in
trouble if the NZ rules change.

If you're prepared to re-upload your page at the critical moment
each Spring and Autumn, of course, you only have to add 12 or 13
hours to GMT.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #4

"Dr John Stockton" <sp**@merlyn.demon.co.uk> wrote in message
news:kB**************@merlyn.demon.co.uk...
JRS: In article <mi*******************@news.xtra.co.nz>, dated Tue,
5 Oct 2004 11:49:10, seen in news:comp.lang.javascript, WindAndWaves
<ac****@ngaru.com> posted :

Is it possible to display the time on a site using javascript. I want to
show visitors the current time in New Zealand, but the javascript that I useactually displays the time on the users computer (i.e. completely
useless).
Read the newsgroup FAQ, posted here regularly and via sig line 2.
With care, that will lead you to <URL:http://www.merlyn.demon.co.uk/
js-date5.htm#Demo> ; select the fourth entry in the drop-down, then
Run. Check the TZ string.

Or enter Wellington NZST-12NZDT,M10.1.0/2:00,M3.3.0/2:00 as a
line in <URL:http://www.merlyn.demon.co.uk/js-date5.htm#SLHD>

Check the change dates & times.

RSVP any corrections.

The code can be simplified for a specific case, but then you are in
trouble if the NZ rules change.

If you're prepared to re-upload your page at the critical moment
each Spring and Autumn, of course, you only have to add 12 or 13
hours to GMT.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 © <URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources. <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items,

links.

Dear John

I had a really good look at your page, but it looks rather technical! More
the kind of thing for a PhD..

Anyway, I am going to have a crack at it.

Thank you.
Jul 23 '05 #5
Is there a routine anywhere, not necessarily javascript, that can be
used to directly access a time server and display time, using
parameters to adjust for time zone, on a web site without going through
a third-party site?

--
Dennis Marks
http://www.dcs-chico.com/~denmarks/
Mail to the return email address is bounced.
Go to web site for active email address.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 23 '05 #6
JRS: In article <10*************************@dcsi.net>, dated Sun, 10
Oct 2004 09:05:03, seen in news:comp.lang.javascript, Dennis M. Marks
<de******@dcsi.net> posted :
Is there a routine anywhere, not necessarily javascript, that can be
used to directly access a time server and display time, using
parameters to adjust for time zone, on a web site without going through
a third-party site?


Yes, site www.heavens-above.com uses one, IIRC. Surely there are other
sites showing the capability.

It is sufficient to take code to access UTC/GMT from a server, and to
apply to its result the algorithms on my site, translated into language-
of-choice. The algorithms can be re-invented; and may be in the
libraries of some languages. Do not, however, trust any code written in
countries with a historical tradition of non-compliance with accepted
standards; if they can get it wrong, they will.

Allowing for time zone is trivial; one merely uses
setUTCHours(getUTCHours() + N) . Allowing for summer time transitions
given by reasonable rules is not too difficult. Allowing for the
decisions of politicians on time changes would require continuing
effort.

I don't know ASP, PHP, etc. - others here do - but ISTM that you could
use such technologies to deliver web-server time (which *should* be
time-server synchronised) with the page, which could determine the local
clock error, and then use my code, or similar, to display corrected
local time. Let the page self-refresh at intervals, to take out local
clock drift.

You don't say how the time zone required is to be determined; author's
choice, reader's choice, reader's location, ?.

One could use the time server to determine the current error of the
user's local GMT, which will (if the user is correctly configured) be
the same as the current error of the user's local local time (except
briefly at the summer/winter transitions), and can be used to correct
the latter for display.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Jul 23 '05 #7
In article <MA**************@merlyn.demon.co.uk>, Dr John Stockton
<sp**@merlyn.demon.co.uk> wrote:
JRS: In article <10*************************@dcsi.net>, dated Sun, 10
Oct 2004 09:05:03, seen in news:comp.lang.javascript, Dennis M. Marks
<de******@dcsi.net> posted :
Is there a routine anywhere, not necessarily javascript, that can be
used to directly access a time server and display time, using
parameters to adjust for time zone, on a web site without going through
a third-party site?


Yes, site www.heavens-above.com uses one, IIRC. Surely there are other
sites showing the capability.


It seems as though the time is generated at the server since it is
already within the source of the page when I look at it. I should have
made it clear that I was looking for a non-server method. Maybe there
is somewhere in the site that the time is generated from code within a
page. If so, please point it out.

Is there a way to link to a time server, have data returned, and then
manipulate the returned data with code within a web page?

I do not have any current plans to use the code. I am just interested
in how and if it can be done at the user level.

--
Dennis Marks
http://www.dcs-chico.com/~denmarks/
Mail to the return email address is bounced.
Go to web site for active email address.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 23 '05 #8

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

Similar topics

5
2056
by: Mystery | last post by:
Can anyone point me to a script that will allow me to list x number of records per page and give me a page selector and information like the one in the subject header? Thanks.
8
5775
by: euang | last post by:
Hi, I have been using access 2000 for two years on WINDOWS NT to display dynamic aweb page using ASP My ISP has now changed to Windows 2003, and I am having major problems displaying...
1
508
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time...
2
4313
by: RAJ | last post by:
In our multi-tier application, we have several ASP.NET user controls which will update the same data source provided by middle tier logic. In this particular scenario we have one user control...
1
1705
by: David Lozzi | last post by:
Hello, I'm wondering whats the best method to use for displaying several photos' thumbnails. One method I know is to dynamically resize the photo at the time the page is loaded. What does this...
4
7116
by: MrL8Knight | last post by:
Hello, I am trying to build a simple php form based shopping cart using a cookie with arrays. I need to use 1 cookie because each order will have over 20 items. With that said, I realize I need to...
11
2403
by: dba | last post by:
Have been displaying data from database using html for some time but just recently trying to display data back to "form". Can't find answer. <form method="post" action="<?php echo $PHP_SELF;?>">...
0
1444
by: Steve | last post by:
The approach in this thread looks wrong to me considering your example. Your example shows you have random time periods between 6AM and 6 PM for appointments. Appointment 1 is 1-1/2 hour,...
1
1366
by: MLH | last post by:
Without explicitly typing each global var into code module for displaying, does VBA have any facility for determining what GV's are defined in a given database? You know, something like a Set or...
7
6633
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
7225
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
7123
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
7498
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
5627
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
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...
0
4707
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...
0
3194
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...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1557
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 ...

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.