R Under development (unstable) (2024-01-22 r85820 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > #!/usr/bin/Rscript > > Sys.setenv(TZ="America/Chicago") > options(digits.secs=6) > library(RApiDatetime) > > x <- format(as.POSIXct(Sys.time() + 0:1, origin="1970-01-01")) > str(x) chr [1:2] "2024-01-23 06:52:49.718395" "2024-01-23 06:52:50.718395" > > X <- rapistrptime(x, "%Y-%m-%d %H:%M:%OS", "") > str(X) POSIXlt[1:10], format: "2024-01-23 06:52:49.718395" "2024-01-23 06:52:50.718395" > > str(rapiAsPOSIXct(X)) POSIXct[1:2], format: "2024-01-23 00:52:49.718394" "2024-01-23 00:52:50.718394" > str(rapiAsPOSIXlt(rapiAsPOSIXct(X))) POSIXlt[1:2], format: "2024-01-23 06:52:49.718394" "2024-01-23 06:52:50.718394" > > str(rapiPOSIXlt2D(X)) Date[1:2], format: "2024-01-23" "2024-01-23" > > str(rapiD2POSIXlt(rapiPOSIXlt2D(X))) POSIXlt[1:2], format: "2024-01-23" "2024-01-23" > > str(rapiFormatPOSIXlt(X, "%Y-%b-%d %H:%M:%OS")) chr [1:2] "2024-Jan-23 06:52:49.718395" "2024-Jan-23 06:52:50.718395" > str(rapiFormatPOSIXlt(X, "%Y-%b-%d %H:%M:%OS", TRUE)) chr [1:2] "2024-Jan-23 06:52:49.718395 Ame" ... > > str(asDatePOSIXct(.POSIXct(1540181413, "America/Chicago"))) Date[1:1], format: "2018-10-22" > > proc.time() user system elapsed 0.10 0.06 0.17