date_range_CEST: When does Summer Time start / end?

Description Usage Arguments Examples

View source: R/date_range_cest.R

Description

At what days does the summer time start /end in a given year?

Usage

1

Arguments

year

Scalar year number between 1980 and 2100.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# At what days does summer time start and end, respectively, in 2010?
date_range_CEST(2010)
  
# Check if summer time really starts at 2010-03-28. Timestamps between
# 2:00 (inclusive) and 3:00 (exclusive) do not exist in Central European Time
# Note that in this case R removes the time information!
as.POSIXct("2010-03-28 01:59:59", tz = "Europe/Berlin") # CET
as.POSIXct("2010-03-28 02:00:00", tz = "Europe/Berlin") # Time removed!
as.POSIXct("2010-03-28 02:59:59", tz = "Europe/Berlin") # Time removed!
as.POSIXct("2010-03-28 03:00:00", tz = "Europe/Berlin") # CEST

# Check if summer time really ends at "2010-10-31. Timestamps between
# 2:00 (inclusive) and 3:00 (exclusive) exist twice, once in CEST and a 
# second time in CET, so R does not know which one you mean! 
as.POSIXct("2010-10-31 01:00:00", tz = "Europe/Berlin") # CEST
as.POSIXct("2010-10-31 02:00:00", tz = "Europe/Berlin") # CEST

# R seems to decide (on my computer!) that times before 02:01:50 belong to
# CEST and at or after that time belong to CET!
as.POSIXct("2010-10-31 02:01:49", tz = "Europe/Berlin") # CEST
as.POSIXct("2010-10-31 02:01:50", tz = "Europe/Berlin") # CET

as.POSIXct("2010-10-31 02:02:00", tz = "Europe/Berlin") # CET
as.POSIXct("2010-10-31 03:00:00", tz = "Europe/Berlin") # CET

# Get the starts and ends of CEST for a sequence of years
date_range_CEST(2017:2020)

KWB-R/kwb.datetime documentation built on July 9, 2021, 10:28 p.m.