473,545 Members | 2,772 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 1582
On Tue, 5 Oct 2004 11:49:10 +1300, WindAndWaves <ac****@ngaru.c om> 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.worldtimese rver.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.******@bluey onder.co.invali d> wrote in message
news:opsfd0f5ii x13kvk@atlantis ...
On Tue, 5 Oct 2004 11:49:10 +1300, WindAndWaves <ac****@ngaru.c om> 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.worldtimese rver.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.xt ra.co.nz>, dated Tue,
5 Oct 2004 11:49:10, seen in news:comp.lang. javascript, WindAndWaves
<ac****@ngaru.c om> 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.demo n.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.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #4

"Dr John Stockton" <sp**@merlyn.de mon.co.uk> wrote in message
news:kB******** ******@merlyn.d emon.co.uk...
JRS: In article <mi************ *******@news.xt ra.co.nz>, dated Tue,
5 Oct 2004 11:49:10, seen in news:comp.lang. javascript, WindAndWaves
<ac****@ngaru.c om> 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.demo n.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.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources. <URL:http://www.merlyn.demo n.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************ *************@d csi.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(get UTCHours() + 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.demo n.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demo n.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.de mon.co.uk> wrote:
JRS: In article <10************ *************@d csi.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
2061
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
5778
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 information from MEMO fields within the Access 2000 database. I have not had any problems before displaying MEMO fields on NT and have tried various tips...
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 store in the database. However asp recognizes the data type as date and displays the date instead of the time. If I change the data type in mysql...
2
4322
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 displaying the contents of the data source, whilst another control updates the datasource via a command buttons implementation of 'Click', an event...
1
1708
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 do to server/site performance? The other is to copy the photo at time of upload and create a thumbnail then, have two separate images, therefor when...
4
7123
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 serialize the data to put the array into the cookie. That part of my code is working just fine and displaying fine. The problem I’m having is when I...
11
2406
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;?>"> First Name:<input type="text" size="12" maxlength="12" name="Fname"><br > Last Name:<input type="text" size="12" maxlength="36" name="Lname"><br />...
0
1456
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, Appointment 2 is 3 hours and Appointment 3 is 1 hour. It is only by coincidence (or common practice) that the appointment start and end times fall on what...
1
1368
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 Collection of global vars. Would be nice to walk the set of GV's from time to time, displaying their names 'n values.
7
6638
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 tabcontainer which has 1 panel already, however I want to try create the TabPanels dynamically. I followed the advice here: ...
0
7502
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7692
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7946
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...
0
6026
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3491
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...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1921
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
1
1045
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
744
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...

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.