Rounding time to nearest quarter hour

前端 未结 7 637
清酒与你
清酒与你 2020-12-03 13:43

I have a vector of POSIXct values and I would like to round them to the nearest quarter hour. I don\'t care about the day. How do I convert the values to hours and minutes?<

7条回答
  •  盖世英雄少女心
    2020-12-03 13:48

    Indeed, an old question with some helpful answers so far. The last one by giraffhere seems to be the most elegant. however, ist not floor_date but round_date which will do the trick:

    lubridate::round_date(x, "15 minutes") 
    

提交回复
热议问题