Description Usage Arguments Value See Also Examples
View source: R/standardise-datetime.r
Corrects for any time zone and day light savings difference in a date-time object
and returns as tz = 'UTC' but shifted by the standardised_offset. Depending
on the logging device recorded date times are often in different time zones,
i.e., Vemco acoustic receiver detections (UTC), Onset
temperature logger readings (PST or PDT depending on when deployed)
versus watch (PST or PDT depending on when recorded). To allow analyses to
be performed on the year, month, day, hour etc elements without any errors
it is important to standardise the date time objects so they have the
same time zone. The current function achieves this by forcing all the
date-times to tz UTC and then adjusting for the difference in hours between
the original utc_offset
and the standardised offset.
1 | standardise_datetime(x, standardised_offset = -8)
|
x |
a datetime object |
standardised_offset |
an integer scalar indicating the time difference in hours between UTC and the desired time zone. |
A standardised date-time object.
1 2 3 4 5 6 7 | vemco <- as.POSIXct(c("2000-04-01 17:00:00"), tz = "UTC")
watch <- as.POSIXct(c("2000-04-01 9:00:00", "2000-04-02 10:00:00"), tz = "PST8PDT")
logger <- as.POSIXct(c("2000-04-01 9:00:00", "2000-04-02 9:00:00"), tz = "Etc/GMT+8")
standardise_datetime(vemco)
standardise_datetime(watch)
standardise_datetime(logger)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.