These function converts EMR time to POSIXct format. It takes the EMR time as input and returns the corresponding POSIXct object.

emr_time2posix(time, show_hour = FALSE, tz = "UTC")

emr_posix2time(posix)

Arguments

time

The EMR time to be converted.

show_hour

Logical value indicating whether to include the hour in the output. Default is FALSE.

tz

Time zone to be used for the output POSIXct object. Default is "UTC".

posix

A POSIXct object to be converted to EMR time.

Value

A POSIXct object representing the converted time.

Examples

# 30 January, 1938, 6:00 - birthday of Islam Karimov
t1 <- emr_date2time(30, 1, 1938, 6)
# September 2, 2016, 7:00 - death of Islam Karimov
t2 <- emr_date2time(2, 9, 2016, 7)

emr_time2posix(c(t1, t2))
#> [1] "1938-01-30 UTC" "2016-09-02 UTC"
emr_time2posix(c(t1, t2), show_hour = TRUE)
#> [1] "1938-01-30 06:00:00 UTC" "2016-09-02 07:00:00 UTC"

emr_posix2time(emr_time2posix(c(t1, t2), show_hour = TRUE))
#> [1]  621654 1310575

# Note that when show_hour = FALSE, the hour is set to 0
# and therefore the results would be different from the original time values
emr_posix2time(emr_time2posix(c(t1, t2)))
#> [1]  621648 1310568