| Contents |
|
|
|||
| Continent | Code | Country | Beginning and ending days |
| Africa | st_Egypt | Egypt | Start: Last Friday in April End: Last Thursday in September |
| st_Namibia | Namibia | Start: First Sunday in September End: First Sunday in April |
|
| Asia | st_FormerUSSR | Most states of the Former USSR. | Start: Last Sunday in March End: Last Sunday in October |
| st_Iraq | Iraq | Start: April 1 End: October 1 |
|
| st_Israel | Israel (an approximation) | (Estimate, Israel decides the dates every year) Start: First Friday in April End: First Friday in September |
|
st_Lebanon st_Kirgizstan |
Lebanon, Kirgizstan | Start: Last Sunday in March End: Last Sunday in October |
|
| st_Palestine | Palestine (an approximation) | Start: First Friday on or after 15 April End: First Friday on or after 15 October |
|
| st_Syria | Syria | Start: April 1 End: October 1 |
|
| st_Iran | Iran | Start: the first day of Farvardin End: the first day of Mehr |
|
| Australasia | st_Australia | Australia - South Australia, Victoria, Australian Capital Territory, New South Wales, Lord Howe Island |
Start: Last Sunday in October End: Last Sunday in March |
| st_Tasmania | Australia - Tasmania | Start: First Sunday in October End: Last Sunday in March |
|
|
st_NewZealand st_Chatham |
New Zealand, Chatham | Start: First Sunday in October End: Third Sunday in March |
|
| st_Tonga | Tonga | Start: First Sunday in November End: Last Sunday in January |
|
| Europe | st_EU | European Union UK |
Start: Last Sunday in March at 1 am UTC End: Last Sunday in October at 1 am UTC |
| st_Russia | Russia | Start: Last Sunday in March at 2 am local time End: Last Sunday in October at 2 am local time |
|
| North America |
st_USA st_Canada st_Mexico st_Bahamas |
United States, Canada, Mexico St. Johns, Bahamas, Turks and Caicos |
Start: Second Sunday in March End: First Sunday in November (Post 2007 - no longer implemented) Start: First Sunday in April End: Last Sunday in October |
| st_Cuba | Cuba | Start: April 1 End: Last Sunday in October |
|
| st_Greenland | Greenland | Same as EU |
|
| South America | st_Brazil | Brazil
(rules vary from year to year - and equatorial Brazil does not observe DST) |
Start: First Sunday in November End: Third Sunday in February |
| st_Chile | Chile |
Start: Second Saturday of October End: Second Saturday of March |
|
| st_Falklands | Falklands | Start: First Sunday on or after 8 September End: First Sunday on or after 6 April |
|
| st_Paraquay | Paraguay | Start: First Sunday in September End: First Sunday in April |
|
|
|
|||
#include <codecogs/units/time/summertime.h>
using namespace Units::Time;
| void | summerTime (int Year, double &StartDate, double &EndDate, summerTimeRegion Region) Calculates the start and end of summer time in the specified year and region. | |
| bool | summerTime (double nDate, summerTimeRegion Region) Returns true or false to indicate when daylight saving is active for the provided date and region. |
| voidsummerTime( | int | Year | |
| double& | StartDate | ||
| double& | EndDate | ||
| summerTimeRegion | Region | ) |
#include <stdio.h> #include <codecogs/units/time/summertime.h> #include <codecogs/units/time/hour.h> #include <codecogs/units/time/minute.h> #include <codecogs/units/date/month_str.h> #include <codecogs/units/date/month.h> #include <codecogs/units/date/day.h> #include <codecogs/units/date/date.h> using namespace Units::Time; using namespace Units::Date; int main() { for(int i=2004;i<2006;i++) { printf("\n In year %d",i); double start,end; summerTime(i, start, end, st_UK); printf("\n UK Summer time runs from %2d %s\t%2d:%02d", day(int(start)), month_str(month(int(start))), hour(start), minute(start)); printf(" to %2d %s\t%2d:%02d", day(int(end)), month_str(month(int(end))), hour(end), minute(end)); summerTime(i, start, end, st_Canada); printf("\n Canadian Summer time runs from %2d %s\t%2d:%02d", day(int(start)), month_str(month(int(start))), hour(start), minute(start)); printf(" to %2d %s\t%2d:%02d", day(int(end)), month_str(month(int(end))), hour(end), minute(end)); } return 0; }Output:
In year 2004 UK Summer time runs from 28 March 1:00 to 31 October 1:00 Canadian Summer time runs from 4 April 0:00 to 31 October 0:00 In year 2005 UK Summer time runs from 27 March 1:00 to 30 October 1:00 Canadian Summer time runs from 3 April 0:00 to 30 October 0:00
| Year | is a 4 digit Gregorian year. |
| StartDate | is a location (passed by reference) into which is placed the start date and time when summer time within Year occurs - the point when everyone adds 1hr to the times shown on their clocks. |
| EndDate | is a location (passed by reference) into which is placed the end date and time for summer time - the point when everyone subtracts 1hr from the times shown on their clocks. |
| boolsummerTime( | double | nDate | |
| summerTimeRegion | Region | ) |
if(summerTime(somedate, st_UK)) somedate+=1/24.0;N.B. You should not subtract 1hr from a summer time value in order to obtain standard time for the winter months, as this will yield slightly incorrect times at the transition from winter to summer (the changeover occurring 1 hour early).
#include <stdio.h> #include <codecogs/units/time/summertime.h> #include <codecogs/units/date/day.h> #include <codecogs/units/time/hour.h> #include <codecogs/units/time/minute.h> void main() { double nDate=date("30 oct 2004"); for(double i=22/24.0;i<26/24.0;i+=1/48.0) { double a=nDate+i; bool summer=summerTime(a, st_UK); a+=summer* 1/24.0; printf("\n %s day=%d time=%2d:%02d", summer?"Summer":"Winter", day(int(a)), hour(a), minute(a)); } }Output:
Summer day=30 time=23:00 Summer day=30 time=23:30 Summer day=31 time= 0:00 Summer day=31 time= 0:30 Summer day=31 time= 1:00 Summer day=31 time= 1:30 Winter day=31 time= 1:00 Winter day=31 time= 1:30 Winter day=31 time= 2:00
| nDate | is a serial number of days from 24 November 4714 BC (1 January 4713BC in the Julian Calendar) - also known as the Julian Period. Time during the day is representing using a fraction of the day, i.e. 1hr=1/24.0. |