utc_offset_Berlin_one_day: UTC Offsets of Berlin Local Timestamps within one Day

Description Usage Arguments Value See Also Examples

View source: R/utc_offset_berlin.R

Description

UTC Offsets of Berlin Local Timestamps within one Day

Usage

1

Arguments

x

vector of character representing timestamps in format "yyyy-mm-dd HH:MM:SS". All timestamps must belong to one and the same day.

Value

vector of integer with elements 1 or 2, depending on whether the timestamps at corresponding positions in x represent Central European Time (CET) or Central European Summer Time (CEST).

See Also

utcOffsetBerlinTime

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
28
29
30
31
32
33
34
35
36
37
38
# At what days does Central European Summer Time (CEST) start/end?
cest_begin_end <- kwb.datetime::date_range_CEST(2019)

# Provide text timestamps "around" the switch from CET to CEST
times_cet_cest <- c(
  "2019-03-31 01:00:00", # CET
  "2019-03-31 01:15:00", # CET
  "2019-03-31 01:30:00", # CET
  "2019-03-31 01:45:00", # CET
  "2019-03-31 03:00:00", # CEST
  "2019-03-31 03:15:00", # CEST
  "2019-03-31 03:30:00"  # CEST
)

# Provide text timestamps "around" the switch from CEST to CET
times_cest_cet <- c(
  "2019-10-27 01:00:00", # CEST
  "2019-10-27 01:30:00", # CEST
  "2019-10-27 02:00:00", # CEST
  "2019-10-27 02:30:00", # CEST
  "2019-10-27 02:00:00", # CET
  "2019-10-27 02:30:00", # CET
  "2019-10-27 03:00:00", # CET
  "2019-10-27 03:30:00", # CET
  "2019-10-27 04:00:00"  # CET
)

# Get the offset strings
offsets_cet_cest <- kwb.datetime:::utc_offset_Berlin_one_day(times_cet_cest)
offsets_cest_cet <- kwb.datetime:::utc_offset_Berlin_one_day(times_cest_cet)

# Create ISO norm timestamps including the offset
iso_cet_cest <- sprintf("%s+%02d00", times_cet_cest, offsets_cet_cest)
iso_cest_cet <- sprintf("%s+%02d00", times_cest_cet, offsets_cest_cet)

# Use isoToLocaltime() to create POSIXct-objects in Europe/Berlin
isoToLocaltime(iso_cet_cest)
isoToLocaltime(iso_cest_cet)

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