0

Using R, how do I transform the date and time from here, into a "standard" date/time string format?

2020-12-30T03:32:30.000Z

Yusuf Şengün
  • 294
  • 3
  • 12
Grace
  • 173
  • 12

2 Answers2

1

Use ?strptime

strptime("2020-12-30T03:32:30.000Z", "%Y-%m-%dT%H:%M:%S")
# [1] "2020-12-30 03:32:30 CET"
Ben
  • 724
  • 4
  • 13
1

You can also use:

#Code
as.POSIXct(gsub('T|Z',' ','2020-12-30T03:32:30.000Z'),'%Y-%m-%d %H:%M:%S.%OS')

Output:

[1] "2020-12-30 03:32:30 GMT"
Duck
  • 38,442
  • 13
  • 38
  • 79