473,657 Members | 2,587 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sorry for this trivial question about dates

I want to put date and time on my web page, and to be sure it tracks the
BST/ GMT changes.
Can anyone help me, I have gone back in my historic file for quite a
while and not found anything.
Sorry about the newbie trivial question
--
David Lindsay
anti spam in force use reply to address
Jul 20 '05 #1
12 3523
David Lindsay wrote on 17 sep 2003 in comp.lang.javas cript:
I want to put date and time on my web page, and to be sure it tracks the
BST/ GMT changes.
Can anyone help me, I have gone back in my historic file for quite a
while and not found anything.
Sorry about the newbie trivial question


What do you mean by BST/ GMT changes ?

Time changes all the time. ;-)

Do you want the time in GMT/UTC or in west european time?

Do you want client time or server time ?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
JRS: In article <Xk************ **@sdresearch.c om>, seen in
news:comp.lang. javascript, David Lindsay <sp**@use.rep ly-to.co.uk>
posted at Wed, 17 Sep 2003 21:35:58 :-
I want to put date and time on my web page, and to be sure it tracks the
BST/ GMT changes.
Can anyone help me, I have gone back in my historic file for quite a
while and not found anything.
Sorry about the newbie trivial question


Try reading the newsgroup FAQ on the subject of dates and times.

I assume that you mean the current date and time.

If you want to be SURE of always being correct, you must yourself
include the current EU rules for the change, and update whenever
necessary (unlikely). At least one delivered version of Windows has the
rules for the UK wrong.

Putting the current local date & time is a pointless exercise; most OSs
already show it, most users know the date and can see a proper clock or
a watch.

There is a use for showing the current British time to foreigners; for
example to help Radio 2 listeners sited across the Channel.

For use in the EU, you only need to apply the correct fixed offset to
their local time; but for that you need their location, which can be
adequately deduced from new Date(0).getTime zoneOffset().

Otherwise, you need to implement the UK Rules, as in js-date5.htm#UKnow
function BritNow (uses EUch). Note that the UTC of the resulting Object
must be displayed; UTCDstr is in include3.htm, visible in js-nclds.htm

If you are only interested in readers whose computer uses UK time, and
can disregard possible OS errors, display the date object directly, but
do not use toLocaleString (it is wrong in my browser). Best to supply a
display routine such as ISOlocalDTstr (/loc cit/).

You should, of course, point out the dependence on the correctness of
the viewing computer's time adjustment.

--
© 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 20 '05 #3
In message <Xn************ ********@194.10 9.133.29>, Evertjan.
<ex************ **@interxnl.net > writes
David Lindsay wrote on 17 sep 2003 in comp.lang.javas cript:
I want to put date and time on my web page, and to be sure it tracks the
BST/ GMT changes.
Can anyone help me, I have gone back in my historic file for quite a
while and not found anything.
Sorry about the newbie trivial question
What do you mean by BST/ GMT changes ?

we change from GMT to British summer Time and back again every year
Do you want the time in GMT/UTC or in west european time?
The actual time in the United Kingdom, as on the server.
Do you want client time or server time ?

TIA
--
David Lindsay
anti spam in force use reply to address
Jul 20 '05 #4
David Lindsay wrote on 19 sep 2003 in comp.lang.javas cript:
In message Evertjan wrote
Sorry about the newbie trivial question

What do you mean by BST/ GMT changes ?

we change from GMT to British summer Time and back again every year
Do you want the time in GMT/UTC or in west european time?

The actual time in the United Kingdom, as on the server.


Wich is Western European time.
Do you want client time or server time ?

TIA


If we are talking client coding:
If the client machine is correctly configured and has the correct time and is in the UK,
you can just take the javascript time functions, they are correct.

=============== =======

If we are talking server coding and the server has the correct time and is in the UK the
same applies.

=============== =======

if the server is somewhere else, say in Toronto, then you are in trouble. The swich
times are hours and sometimes a also week apart.

Serverside ASP javascript can deduct the actual UTC time.
For correction to Western European Summertime you can add one hour to UTC, but the
switch moment has to be hardcoded in your code, I presume.

Not tested, but try it out:

<script language=javasc ript runat=server>

summertimestart 03 = Date.UTC(2003,3-1,30,1);
summertimeend03 = Date.UTC(2003,1 0-1,26,1);
// see <http://www.npl.co.uk/time/time_summer.htm l>

d = new Date();
if((d>summertim estart03)&&(d<s ummertimeend03) )d+=60*60*1000;
if((d>summertim estart04)&&(d<s ummertimeend04) )d+=60*60*1000;
if((d>summertim estart05)&&(d<s ummertimeend05) )d+=60*60*1000;
c = ":";
s = d.getUTCHours() + c;
s += d.getUTCMinutes () + c;
s += d.getUTCSeconds () + c;
s += d.getUTCMillise conds();

Response.write( s);

</script>

=============== ==========

see for more help:

<http://www.merlyn.demo n.co.uk/uksumtim.htm>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #5
JRS: In article <Xn************ ********@194.10 9.133.29>, seen in
news:comp.lang. javascript, Evertjan. <ex************ **@interxnl.net >
posted at Fri, 19 Sep 2003 14:49:55 :-
David Lindsay wrote on 19 sep 2003 in comp.lang.javas cript:
In message Evertjan wrote
Sorry about the newbie trivial question
What do you mean by BST/ GMT changes ?

UK civil time is identical to Dutch, except that good Dutch clocks are
*always* an hour ahead of ours.
we change from GMT to British summer Time and back again every year
Do you want the time in GMT/UTC or in west european time? The actual time in the United Kingdom, as on the server.


Wich is Western European time.


You might call it that; we do not! What do you call the Dutch and
Graeco-Finnish time zones in Europe?
if the server is somewhere else, say in Toronto, then you are in trouble. The
swich
times are hours and sometimes a also week apart.
No problem. It's all done somewhere on my site; if Toronto time is not
New York time (the map in my diary is *small*, just change 5 to 6)
Serverside ASP javascript can deduct the actual UTC time.
For correction to Western European Summertime you can add one hour to UTC, but
the
switch moment has to be hardcoded in your code, I presume.


Indeed not. In js-date5.htm (M=3 or M=10) :

function EUch(Y, M) { // return ms of Spring/Autumn EU clock change
var J = Date.UTC(Y, M-1, 31) // last of month is 31st, get UTC
return J - 864e5*((4+J/864e5)%7) + 36e5 /* Sun, 0100 GMT, ms */ }

Valid for all years and all of the EU under present rules.

I've not consolidated the NA code to that extent, but it includes

var DSTon = (new Date(Date.UTC(Y r, 03, 07, 2-TZ))).toSunday( )
var DSTof = (new Date(Date.UTC(Y r, 09, 31, 1-TZ))).toSunday( )

with
Date.prototype. toSunday = new Function( // back by 0-6 days
'return new Date(this.setDa te(this.getDate ()-this.getDay())) ')

For NY (& To?), TZ=-5.

<URL:http://www.merlyn.demo n.co.uk/js-date5.htm#DDTA> does it for
anywhere, al long as a suitable TZ string can be provided. Tel Aviv
might be difficult.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Jul 20 '05 #6
JRS: In article <j5************ **@sdresearch.c om>, seen in
news:comp.lang. javascript, David Lindsay <mu**@use.rep ly-to.co.uk>
posted at Fri, 19 Sep 2003 14:55:56 :-
Do you want the time in GMT/UTC or in west european time?


The actual time in the United Kingdom, as on the server.


AIUI, servers generally run on GMT, even in outlandish places like other
countries, and even in the Summer. It is not a server's business to
care where its clients are or think they are. AIUI, there is, for
example, a piece of the British Mainland that operates on Paris time.

It seems clear that you want to display, to a correctly-set user
anywhere in the world, the time we use here - UK Civil Time.

Give or take a quibble about whether UK Civil Time is or should be UTC
or GMT. I think the best UK clocks show UTC, but legally Summer Time
starts/stops by GMT. It may have changed.
function BritNow(Now) { // gives UTC with UK time numbers
var yr = Now.getUTCFullY ear()
var EUSTon = EUch(yr, 03), EUSTof = EUch(yr, 10)
// abroad: add winter TZ offset; update change rules if not EU
var ms = Now.getTime() // GMT
if ((ms>=EUSTon) && (EUSTof>ms)) ms += 3600000 // +1h
return new Date(ms) }

function TryBritNow() { document.writel n(
'<table summary="Britis h Date"',
' bgcolor=#FFA500 align=center cellpadding=10> ',
'<tr><td>Page shown at ',
BritNow(new Date()).UTCDstr (), ' British civil time,',
' by your clock.<\/td><\/tr><\/table>') }

which drives <URL:http://www.merlyn.demo n.co.uk/js-date5.htm#UKNow >.

--
© 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 20 '05 #7
Dr John Stockton wrote on 19 sep 2003 in comp.lang.javas cript:
UK civil time is identical to Dutch, except that good Dutch clocks are
*always* an hour ahead of ours.
we change from GMT to British summer Time and back again every year
Do you want the time in GMT/UTC or in west european time?
The actual time in the United Kingdom, as on the server.
Wich is Western European time.


You might call it that; we do not! What do you call the Dutch and
Graeco-Finnish time zones in Europe?


There is no Dutch time zone nowadays!

Europe ["The union as we know it"] has three time zones:

Western European Time
Central European Time
Eastern European Time

If you want to call your time "British standard time" or "London time" ot
"Travalgar square time", so be it, but those are only local names of the
same, these are leftover names from the time when local time was
different in each town or count(r)y, and railway time was another time
again.

Any question about time zone manipulation code on an internationally used
NG should address the whole of the time zone and not just such a local
name.

I, as an European, am proud the Europen times switches to and from
summertime (US: daylight saving time) at the same absolute time, 01:00
UTC, and not like the North American system where the switch ripples
through the continent, and interstate travel on those nights sould be an
exact local time loving exentric's nightmare. In eastern British Columbia
the time zone border runs through the province with roadside notices
warning you on an very irregular basis. In other places I suppose it is
the same.
if the server is somewhere else, say in Toronto, then you are in
trouble. The swich times are hours and sometimes also a week apart.


The nice thing about serverside javascript is that you can get to UTC
immediately, or detect the servers time zone difference.

Serverside vbscript does not have these options, so if you have a server
in Toronto and want to go to UTC or one of the three European times, you
would have to incorporate the Toronto local (EST?) switch times.
No problem. It's all done somewhere on my site; if Toronto time is
not New York time (the map in my diary is *small*, just change 5 to 6)
[ .... etc ... ]


That is why I put a link to your site in my posting, John, your solutions
are by far the most extensive and well tested.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #8
JRS: In article <Xn************ ********@194.10 9.133.29>, seen in
news:comp.lang. javascript, Evertjan. <ex************ **@interxnl.net >
posted at Sat, 20 Sep 2003 08:48:24 :-

I, as an European, am proud the Europen times switches to and from
summertime (US: daylight saving time) at the same absolute time, 01:00
UTC, and not like the North American system where the switch ripples
through the continent, and interstate travel on those nights sould be an
exact local time loving exentric's nightmare. In eastern British Columbia
the time zone border runs through the province with roadside notices
warning you on an very irregular basis. In other places I suppose it is
the same.


There may be problems when the EU eventually fills Europe; that needs
another two zones, and if the change remains at 1 am UTC it will in the
autumn be at 6 am local time by the Asian Border. And Central European
Time will no longer be in the middle; we shall be no better than those
who have the Mid-West well to the East of centre.

But you may not be quite right in saying that the whole EU changes
clocks simultaneously. Brussels has, I agree, said 01:00 UTC; but I
think that the corresponding UK document may put the changes at 01:00
GMT - which can differ by up to 0.9 seconds.

Does anyone know what the 10 (?) about-to-join countries do about Summer
Time?

-

Site editors : mtr -x+ -o/~ *.htm - "this\s+that\s+ tother" lists all
files not containing that phrase, whatever the whitespace

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
I find MiniTrue useful for viewing/searching/altering files, at a DOS prompt;
free, DOS/Win/UNIX, <URL:http://www.idiotsdelig ht.net/minitrue/> Update soon?
Jul 20 '05 #9
Dr John Stockton wrote on 20 sep 2003 in comp.lang.javas cript:
But you may not be quite right in saying that the whole EU changes
clocks simultaneously. Brussels has, I agree, said 01:00 UTC; but I
think that the corresponding UK document may put the changes at 01:00
GMT - which can differ by up to 0.9 seconds.


I certainly doubt that. The UK specs only differ from the rest if it is in
the political interest of the uk government to take the trouble, such as in
the case of the euro, and 0.9 seconds does not win votes in any local
election.

Or the legislators did not know of any difference between GMT and UTC.

40000000 meter x cos 52deg = 24626459 meters
1 day = 86400 seconds
1 second = 285 meter
0.9 second = 256 meter

So the meridian at Greenwich moves a maximum of 256 meters in the maimum
time difference between UTC and GMT. That cannot be acepted ! The Eurostar
would make a big jump between France and the UK, endangering the many
pedestrian illegal immigrants. Talking of tunnel vision.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #10

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

Similar topics

1
3609
by: bml | last post by:
Is "Trivial constructor" either a default constructor generated by compiler or the one you write but it does nothing (empty inside method definition)? Is it required by C++ standard to bypass "construction" in case of trivial constructor, or just implementation-dependent? In which cases is a construction bypassed? Thanks a lot!
9
12389
by: Michael Burtenshaw | last post by:
I would like to make a slide show using random images. The problem is my host is 250.com, and they don't support cgi-programs. Is there another way to accomplish random images?
11
1871
by: sneill | last post by:
I have read a number of posts on the use of eval() in Javascript, and I agree that its use is questionable. But it does beg the following question: "How arbitrary does a string need to be before the use of eval() is required to execute it?" Given the following code, I'm able to evaluate/execute most expressions like: "a.b.c.d()"
3
2358
by: baibaichen | last post by:
hi, i am reading a C++ book, it mentions a term non-trivial object. what i understand is: if a object has: a) trivial constructor b) trivial assignment operator c) trivial destructor then it is a trvial object, otherwise it is a non trivial obect, right? thanks
1
2415
by: tkpmep | last post by:
I expected the following code to work: f = file(fn,"wb") writer = csv.writer(f) for i in range(IMax): writer.writerow(].append( for j in range(N)])) but instead i got the following error message: Error: sequence expected
5
1649
by: John | last post by:
I have 2 tables, one with dates and information about those dates, and one with people information. I want to create a report listing each date and the people who attended on that date (who have that date under the date column in their table). Can I do it and how? Also another problem I'm running into is what if the person is on more than one date? How can I work that out in the tables?
8
1273
by: Trev | last post by:
Hi, If I had a string denoted by MyArray, how would I extract the number in brackets for use in the programme later on? I've tried "\" but all I get is a syntax error. What would be the usage for using the number in the programme (so that I can check if the index is within bounds)? Talking of groupings, if I had a string like MyRef.MyArray.MyVal how would I extract the strings into an array for processing, so that Array = MyRef, Array =
4
1093
by: jobs | last post by:
1. How do I pass a subroutine a reference of an object? For example I have variable datef type datetime. I want to pass to pass datef the variable, not it's value to the sub? 2. In ADO.NET, how can I see what the parsed value of of a SQL command is after @parameters have been passed in?
4
1466
by: pbd22 | last post by:
Hi. I am wondering what do I replace the "this" statement with to get the appropriate container/response. When I try: cal.prototype.dates(cal.days.day); I get
0
8394
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
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
8732
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...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6164
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
5632
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
4152
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...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1615
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.