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
14
votes
3 answers

Handling dates when we switch to daylight savings time and back

I would like to use R for time series analysis. I want to make a time-series model and use functions from the packages timeDate and forecast. I have intraday data in the CET time zone (15 minutes data, 4 data points per hour). On March 31st daylight…
Richi W
  • 3,534
  • 4
  • 20
  • 39
14
votes
3 answers

Accounting for DST in Postgres, when selecting scheduled items

I have a Postgres table of clock alarms (not really, but this is analogous, and easier to explain). Alarms are set by users with a 1 hour resolution, and users can be from many different timezones. The alarms are repeating daily. I want to reliably…
Martin Svalin
  • 2,227
  • 1
  • 17
  • 23
13
votes
5 answers

PHP date_default_timezone_set() Eastern Standard Time (EST)

Long story short Is there an official, un-deprecated timezone that PHP5 recognizes for Eastern STANDARD time--not Eastern DAYLIGHT time? Short story long :-P Wow, I can't believe that PHP makes such a cluster-floogen out of setting the time. I would…
mrbinky3000
  • 4,055
  • 8
  • 43
  • 54
13
votes
3 answers

Get the next date/time at which a daylight savings time transition occurs

I would like to write (or use if it already exits) a function in C# that returns the date/time of the next DST transition given a System.TimeZoneInfo object and a particular "as of" time in that time zone. The time returned should be in the…
Stuart Lange
  • 4,049
  • 6
  • 24
  • 30
13
votes
2 answers

Getting Daylight Savings Time Start and End in NodaTime

How can I get the starting and ending dates for Daylight Savings Time using Noda Time? The function below accomplishes this task but it is horribly unwieldy and is begging for a simpler solution. /// /// Gets the start and end of daylight…
Matt Kline
  • 10,149
  • 7
  • 50
  • 87
13
votes
1 answer

AlarmManager: how to schedule a daily alarm and deal with time changes

I need to set up an alarm daily at a given hour. I'm programming the alarm using AlarmManager.RTC_WAKEUP, so it uses the system time as reference. I'm setting the alarm to first execute at the desired hour, then to repeat daily: …
Mister Smith
  • 27,417
  • 21
  • 110
  • 193
12
votes
2 answers

Spark: converting GMT time stamps to Eastern taking daylight savings into account

I'm trying to convert a column of GMT timestamp strings into a column of timestamps in Eastern timezone. I want to take daylight savings into account. My column of timestamp strings look like this: '2017-02-01T10:15:21+00:00' I figured out how to…
Bob Swain
  • 3,052
  • 3
  • 17
  • 28
11
votes
7 answers

JAVA TimeZone issue EDT Vs EST

I a newbie to java and hence haven't been able figure this out since quite some time. I am using Windows XP and the machine is set to TimeZone: Eastern Time (US & Canada). I have a Java application, which takes the current system time and timezone…
ViV
  • 1,998
  • 8
  • 27
  • 54
11
votes
3 answers

Why can't I set my system time to a time near daylight saving transition

My times, they are changing, that is, because I need them to. I am testing some cases involving a scheduler I use and this involves behavior around transitions to and from daylight saving time. The Code From this post I got a working method that…
DrCopyPaste
  • 4,023
  • 1
  • 22
  • 57
11
votes
2 answers

Daylight Saving Time in Javascript for 1974?

"During the "energy crisis" years, Congress enacted earlier starting dates for daylight time. In 1974, daylight time began on 6 January and in 1975 it began on 23 February. After those two years the starting date reverted back to the last Sunday in…
jeffl8n
  • 916
  • 2
  • 8
  • 20
11
votes
1 answer

jodatime how to know if daylight savings is on

I have an API that needs the timezone. For eg. if I am in california, I need to pass -7 to it when daylight savings is on (California , PDT is GMT - 7) and -8 to it when daylight saving is off. But I am not able to figure out a way of knowing…
fzansari
  • 131
  • 1
  • 3
  • 12
10
votes
2 answers

Import date-time at a specified timezone, disregard Daylight Savings Time

I have time series data obtained from a data logger that was set to one time zone without daylight savings (NZST or UTC+12:00), and the data spans a few years. Data loggers don't consider DST changes, and are synchronized to local time with/without…
Mike T
  • 41,085
  • 18
  • 152
  • 203
10
votes
3 answers

Converting local time to UTC time or vice versa considering daylight saving time

I know how to convert local time to UTC time and vice versa. But I am very much confused about daylight savings time(DST) handling while doing this. So can anyone answer the below questions: 1. Does java internally handle DST when converting…
Newbie
  • 2,979
  • 9
  • 34
  • 41
10
votes
2 answers

How to convert a datetime object between CEST and UTC timezones

I don't want to use the pytz library as the project I am working on requires paperwork to introduce dependencies. If I can achieve this without a third party library I'll be happier. I'm having trouble converting a date between CET and UTC when the…
Peter Wood
  • 23,859
  • 5
  • 60
  • 99
10
votes
1 answer

Python, Pandas: tz_localize AmbiguousTimeError: Cannot infer dst time with non DST dates

I'm trying to import some timeseries data and convert it into UTC so I can merge it with another dataset. This data seems to have 24 hour data and doesn't have DST adjustments. This post gives a similar answer, but they simply drop the line. I need…
Eric O
  • 171
  • 1
  • 9