0

enter image description here

sample_month$started_at_time <- anytime(sample_month$started_at_time)
sample_month$ended_at_time <- format(sample_month$ended_at_time, format = "%H:%M:%S")

I have tried these two codes and they don't seem to work. I was expecting all the timestamp to be the same format.

Martin Gal
  • 16,640
  • 5
  • 21
  • 39
  • Time is described as the number of seconds since `1970-01-01 00:00:00` Now if I told you the date and time, you can easily calculate the seconds that have passed since `1970`. What if I just told you the time? Do you think you can calculate the number of seconds that have passed since 1970? You cannot. because you do not know the date. I hope you understand why you cannot convert your data to datetime. But you can convert them to other types. eg `ITime` using `data.table::as.ITime` or even to `Period` using `lubridate::hms` function etc – Onyambu Apr 10 '23 at 17:55

0 Answers0