【问题标题】:How to calculate time diff and get the result in time format如何计算时间差异并以时间格式获取结果
【发布时间】:2021-08-11 16:55:30
【问题描述】:

我想要下表的时间差异

A B
30/07/2021 23:58 30/07/2021 23:59
30/07/2021 23:58 30/07/2021 23:58
30/07/2021 23:58 30/07/2021 23:58
30/07/2021 23:58 30/07/2021 23:58
30/07/2021 23:58 30/07/2021 23:58
30/07/2021 23:57 30/07/2021 23:58
30/07/2021 23:57 30/07/2021 23:58
30/07/2021 23:57 30/07/2021 23:58

所有方法都尝试过持续给出 1 秒的结果,但我想要时间格式的结果,如 00:00:02

这是我在下面尝试过的方法 proceessing_time =difftime(time1 = Date , time2 = `Updated Time`, units = "secs")

【问题讨论】:

    标签: r dplyr data-science tidyverse


    【解决方案1】:

    你可以使用包hms

    library(hms)
    processing_time = as_hms(B - A)
    

    【讨论】:

      猜你喜欢
      • 2023-03-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-31
      • 1970-01-01
      • 2014-05-04
      相关资源
      最近更新 更多