Skip to contents

This is a convenient wrapper for the unix2YMD... functions

Usage

unixtime_to_str_datetime(unixtime, str_function)

Arguments

unixtime

The unix time: number of seconds since 01/01/1970 00:00:00 UTC

str_function

The date-time string format to convert to. Available options are YMD, YMDh and YMDhm where Y is year (4 digits), M is month (2 digits), D is day (2 digits), h is hour (2 digits) and m is minutes (2 digits).

Value

A date-time string

Examples

unixtime_to_str_datetime(as.numeric(Sys.time()), YMD)
#> [1] "20240202"
unixtime_to_str_datetime(as.numeric(Sys.time()), YMDh)
#> [1] "2024020214"
unixtime_to_str_datetime(as.numeric(Sys.time()), YMDhm)
#> [1] "202402021456"