In R, use lubridate to convert hms objects into seconds

后端 未结 2 813
刺人心
刺人心 2021-02-15 03:12

simple question in lubridate--I want to convert an hms object into its appropriate number of seconds since the start of the day.

For instance

library(lub         


        
2条回答
  •  无人及你
    2021-02-15 03:42

    R>lubridate::period_to_seconds(hms("01:00:00")) 
    

    gives expected 3600 seconds as numeric counting from 00:00:00 or in the case above:

    R>period_to_seconds(hms("12:34:45")) 
    

提交回复
热议问题