Home > database >  How do I format dates as yyyy-mm-ddT00:00:00.0000000Z in R?
How do I format dates as yyyy-mm-ddT00:00:00.0000000Z in R?

Time:07-20

How can I convert a date from Sys.Date() to the date format (yyyy-mm-ddT00:00:00.0000000Z) in R?

Thanks in advance for your help!

CodePudding user response:

Time output formats are given in ?strptime. One way to get what you want it:

 format.Date(Sys.Date(), "%Y-%m-%dT%R:%OS6Z")
 #[1] "2022-07-19T00:00:00.000000Z"

CodePudding user response:

Maybe you want something like this using strftime with the format:

strftime(Sys.time(), format = "%Y-%m-%dT%H:%M:%OS6Z")
#> [1] "2022-07-19T17:58:09.005532Z"

Created on 2022-07-19 by the reprex package (v2.0.1)

  • Related