utcOffsetBerlinTime: UTC Offsets of Berlin Local Timestamps

Description Usage Arguments Value Examples

View source: R/utc_offset_berlin.R

Description

For local timestamps (character) in the format "yyyy-mm-dd HH:MM:SS", of which is known that they are recorded in time zone Europe/Berlin, i.e. CET in winter and CEST in summer, the UTC offset (i.e. "+1" in winter and "+2" in summer) is determined. Therefore, it is required that the timestamps are ordered by time, which should be the case if they were recorded by a measuring device. Use this function to create unique timestamps by adding their UTC offset.

Usage

1
utcOffsetBerlinTime(timestamps)

Arguments

timestamps

vector of character representing timestamps in format "yyyy-mm-dd HH:MM:SS"

Value

vector of elements "+0100" or "+0200", depending on whether the timestamps at corresponding positions in timestamps are in CET or CEST, respectively.

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
# Change from CET to CEST
utcOffsetBerlinTime(c(
  "2017-03-26 01:58:00",
  "2017-03-26 01:59:00",
  "2017-03-26 03:00:00", # jump from 02:00 to 03:00
  "2017-03-26 03:01:00",
  "2017-03-26 03:02:00"
))
  
#> "+0200" "+0200" "+0100" "+0100" "+0100"

# Note that the following timestamps do not exist in Europe/Berlin timezone
# and would result in an error
## Not run: 
utcOffsetBerlinTime(c(
  "2017-03-26 02:00:00",
  "2017-03-26 02:15:00",
  "2017-03-26 02:30:00",
  "2017-03-26 02:45:00"
))
## End(Not run)

#> "+0200" "+0200" "+0200" "+0200"

# Change from CEST to CET
utcOffsetBerlinTime(c(
  "2017-10-29 01:30:00", # CEST
  "2017-10-29 02:00:00", # first time: CEST
  "2017-10-29 02:30:00", # first time: CEST
  "2017-10-29 02:00:00", # second time: CET
  "2017-10-29 02:30:00"  # second time: CET
))
  
 #> "+0200" "+0200" "+0200" "+0100" "+0100"

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