helper function to convert SAS date numeric to date

convert_to_date(x)

convert_to_datetime(x)

convert_to_time(x)

Arguments

x

date or datetime variable

Examples

 # 2000-03-17
 convert_to_date(14686)
#> [1] "2000-03-17"
 # 2012-11-10 03:49:19
 convert_to_datetime(1668138559)
#> [1] "2012-11-10 03:49:19 UTC"
 # 04:04:46
 convert_to_time(14686)
#> [1] "04:04:46"