Questions tagged [dst]

DST is the tag for Daylight Saving Time issues. DST, also known as summer time, starts when a time zone shifts its clocks forward (in the spring), and ends when the clocks shift back (in the fall).

DST is the tag for Daylight Saving Time issues. Daylight Saving Time is the period when a time zone shifts its time forward in the spring (usually by one hour) and then shifts back in the fall. This creates many programming issues dealing with the lost hour in the spring, and the extra hour in the fall.

Daylight saving time is sometimes called "Summer Time", as time is changed during the summer as compared to the rest of the year. Keep in mind that the northern and southern hemispheres observe summer at different times.

Also, sometimes the term is erroneously called "daylight savings time", or just "daylight savings". Neither term is correct. There is no "s". Another erroneous term is "Day Light Savings" (or "DLS"), which is incorrect because "daylight" is a single word. All of these terms should be avoided.

To illustrate the effects of DST, consider the following graphs. These represent the daylight saving time transitions for the US Pacific time zone.

                Spring Forward DST Transition

                Fall Back DST Transition

While other time zones may transition at different points in time, the behaviors are similar. There is a "gap" of missing local time during the "spring forward" transition, and there is an "overlap" of ambiguous local time during the "fall back" transition.

These graphs also demonstrate the mathematical behaviors of the transitions:

  • Conversion from UTC to Local Time is a function over the range of all time that the local time zone was in existence.

    • However, it may not be a continuous function, due to the transitional adjustments that are made for daylight saving time.

    • Keep in mind that the local time zone was probably not always well defined, or it may have been defined using some earlier calendar system.

  • Conversion from Local Time to UTC is not a pure function because:

    • There may be a discontinuity for the "spring forward" transition, so a local time in this range would be undefined.

    • There may be a range where it is not a function at all, because there is more than one possible outcome for a single input, which occures during the "fall-back" transition.

    • This can lead to problems because some people think that you can always convert in either direction, which is false for any time zone that observes daylight saving time.

Also keep in mind that in the Northern Hemisphere, the "spring forward" transition occurs early in the year and the "fall back" transition occurs late in the year. However, in the Southern Hemisphere the seasons are inverted, so the "fall back" transition typically comes early in the year, while the "spring forward" transition comes late in the year.

Also keep in mind:

  • Not every time zone of the world uses daylight saving time. In fact, the majority do not. See this Wikipedia Article for details.

  • Of those that uses it, each time zone decides how DST applies. Different countries will start and end daylight time at different dates.

  • Not every time zone transitions by one hour. For example, the Australia/Lord_Howe time zone only shifts by 30 minutes.

  • Governments of the world often make changes to how they want to follow DST. You cannot assume that the current rules have always applied in the past or always will apply in the future.

  • DST transition days will have less or more actual time than 24 hours. In most cases, spring-forward days will have 23 hours, and fall-back days will have 25.

  • There are not always exactly a single pair of DST transitions in a given year. Other real-world cases include:

    • One spring transition : This occurs when a time zone decides to stay on "permanent summer time". For example, in 2015 the Turks and Caicos Islands sprung forward in March and stayed there. This is often modeled as a change in base-offset from UTC-5 to UTC-4.

    • One fall transition : This occurs when a time zone that was on "permanent summer time" switches back to standard time. This occurred across Russia in 2014.

    • Two transitions : This is the common case.

    • Three transitions : This is much rarer, but occurred in 2011 in Samoa. The first two transitions were for DST, and the third occurred when 24 hours were skipped to change the island's base-offset from UTC-10 to UTC+14.

    • Four transitions : This occurs when a country that observes DST decides to suspend it temporarily. This has been done in both Egypt and Morocco for the observation of Ramadan.

1319 questions
0
votes
3 answers

ASP.NET Time Conversion on server (Daylight Savings)

Let me start off by giving you all a brief run down of our application! (Please don't be instantly turned off by my large post, its quite simple scenario, I was just descriptive!) We have an ASP.NET web site, mostly C#, which acts as a store front…
clamchoda
  • 4,411
  • 2
  • 36
  • 74
0
votes
3 answers

Java Date Object : daylight saving

I have a Client-Server based java application.The client is running in US/Pacific timezone and the server in UTC( I am saving the time in the database in UTC) So for example, if I save the date as 09:00 Hrs Pacific time, it gets saved in the DB as…
Dunxton
  • 408
  • 1
  • 8
  • 21
0
votes
1 answer

How to get timezone hour offset and account for DST with PEAR::Date?

I am trying to get the offset hours from UTC, given a summer date. My system time is set to America/Los_Angeles. I have the following: require_once("Date.php"); $dateTZ = new Date_TimeZone('America/Los_Angeles'); echo $dateTZ->getOffset(new…
Chad Johnson
  • 21,215
  • 34
  • 109
  • 207
0
votes
3 answers

How do you calculate if a specific time in a specific time zone is affected by daylight savings using JavaScript?

I know that new Date().getTimezoneOffset() accounts for the local user's timezone & DST, but how to calculate the current local time in say Timbuktu for an arbitrary time in the future?
Mark
  • 4,719
  • 4
  • 18
  • 11
0
votes
1 answer

Given unix time and timezone name, determine if DST is in effect

What it says. Language is PHP (in a Moodle farmework). Timestamp may be in future or past. Timezone name is a standard US timezone name (I can survive if it doesn't work outside the USA), could use UTC instead (again, doesn't need to work outside…
0
votes
4 answers

Java and Windows Regional Settings

Sorry if this is a re-post. I did not find a suitable answer. Please ignore best practices and use of deprecated apis. I want to format the following date "Mon May 19 02:16:52 EDT 2003" into "MM/dd/yyyy HH:mm:ss". Again, I only want to change the…
user1318311
  • 25
  • 1
  • 5
0
votes
2 answers

Enumerate over time zones on a Windows Mobile device

Is there a way to get a list of time zones available on a Windows Mobile 6 (or even better 6.5.3) device? I need information about the bias, the standard bias, the daylight bias and the shifting dates (as in TIME_ZONE_INFORMATION). Those are the…
Gene
  • 4,192
  • 5
  • 32
  • 56
-1
votes
2 answers

How to get time and date from UTC to EST without worrying about Daylight Saving Time(DST)

I have one service which requires the data of date and time which I am collecting from my database. The data in the database is stored according to the UTC time zone. Now I want to get those data from the data and present it to the user in the time…
Patel Harsh
  • 231
  • 1
  • 2
  • 7
-1
votes
1 answer

C++ - Saving time in a file, then comparing it with current time

I would like to store/save time in a file. That's no issue, BUT: What if a time zone changes? Or daylight time may differ. How can I compare the saved time in a file with the current time? What if the time zone changes or daylight shifts. Current…
-1
votes
1 answer

Why does JavaScript Date(0) return 1am GMT+1 Jan 1st 1970?

I am in London (GMT time zone). We are currently in DST. In the UK, Daylight Saving Time starts in March and ends in October, so Jan 1 1970 would have been outside DST. However, epochDate = new Date(0); console.log(epochDate); returns Thu Jan 01…
AlanQ
  • 91
  • 1
  • 12
-1
votes
1 answer

Get the time of the next DST change in python

What would be an easy way to get the time and date of the next time change for a given timezone (in my case US/Eastern) ? I'm hoping there's a better way than iterating over every date until the %Z changes. Thanks
Kevin
  • 135
  • 1
  • 9
-1
votes
1 answer

ConvertZone() returns NULL using TZDB SQL Server Zone Support

We are running SQL Server 2008 R2, so for Timezone stuff we use Matt Johnson's SqlServerTimeZoneSupport/ We convert datetimes on the fly using ConvertZone for our clients. Some Australian states support Daylight Savings, some don't. Upgrading SQL…
Hecatonchires
  • 1,009
  • 4
  • 13
  • 42
-1
votes
1 answer

Is there any way to find out the range of time before and after daylight savings in C#?

There are plenty of options available in TimeZoneInfo class to find out current server time UTC offset, if the time is daylight saving time or not etc. But is there any way to find out the ranges of daylight saving time for a given date range So…
Pawan Nogariya
  • 8,330
  • 12
  • 52
  • 105
-1
votes
1 answer

What all do I need to do in a support environment before Daylight Savings starts?

My company is supporting the following applications for an US client: IBM Mainframe , DB2 , Unix , Teradata , Oracle , SQL Server 2005 , Lawson Since Daylight Savings will start by next month, I would like to know your general thoughts about what…
Visakh
-1
votes
1 answer

Moment.js doesn't show correct time

When running my node.js project locally on my computer, moment.js is showing correct time (2019-10-28T07:00:00.000Z because moment have adjusted for DST +02:00 in april and +01:00 in october)): Moment { _isAMomentObject: true, _i:…
Ivan C Myrvold
  • 680
  • 7
  • 23