TIP: Click on subject to list as thread! ANSI
echo: science
to: All
from: DAVID WILLIAMS
date: 2006-11-03 21:54:12
subject: Daylight Saving Time

A few years ago, I wrote a few lines of BASIC to calculate the dates on 
which DST starts and ends in any year, in North America. (The rules are 
different elsewhere.) Now, the rules are changing, so I've modified the 
program to calculate the second Sunday in March and the first Sunday in 
November. 
  
It turns out that, in any year, March and November start on the same 
day of the week, which made the program a bit simpler than the original 
version, in which the months were April and October. 
  
For anyone who is interested, here it is. 
  
                                   dow 
  
-------------------------------------------------------- 
  
' DSTDATE.BAS 
' Calculates start and end dates of Daylight Saving Time 
' David Williams, 2002 
' Modified for new DST rules, 2006 
' david.williams{at}ablelink.org 
  
DEFINT A-Z 
CLS 
INPUT "Year"; Y 
IF Y < 2007 THEN BEEP: PRINT "Not valid before 2007": END 
IF Y > 26212 THEN BEEP: PRINT "Not valid after 26212": END 
B = 7 - (2 + Y + Y \ 4 - Y \ 100 + Y \ 400) MOD 7 
F = 7 + B 
PRINT "In most of North America, in the year"; STR$(Y); 
PRINT ", clocks are set ahead on" 
PRINT "March"; STR$(F); ", and back on November";
STR$(B); "." 
PRINT "Both dates are Sundays." 
END 
  
--------------------------------------------------------------- 
--- Platinum Xpress/Win/WINServer v3.0pr5
* Origin: The Bayman BBS,Toronto, (416)698-6573 - 1:250/514 (1:250/514)
SEEN-BY: 633/267 270
@PATH: 250/514 123/500 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.