calc_single_datetime: Convert UTC to local time for a single observation

Description Usage Arguments Value Examples

Description

This function calculated the local date-time for an observation based on a date-time in Coordinated Universal Time (UTC). The function provides a wrapper for the with_tz function form the lubridate package. It converts output from the with_tz function to a character vector so other functions in this package can be applied without error to with a dataframe with observations from multiple time zones to local time.

Usage

1
calc_single_datetime(datetime, tz)

Arguments

datetime

A POSIXct object of length one expressed in Coordinated Universal Time (UTC)

tz

A character string giving the local time zone based on the Olson/IANA time zone names

Value

A character string giving the date-time in the local time zone

Examples

1
2
utc_time <- as.POSIXct("1999-09-15 14:30:00", tz = "UTC")
local_time <- calc_single_datetime(utc_time, tz = "US/Eastern")

geanders/countytimezones documentation built on May 17, 2019, 12:14 a.m.