The base case, with individually entered times
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
basetime <- ymd_hms("2010-12-13 00:00:00")
drawtime <- ymd_hms("2010-12-13 15:30:30")
elapsed <- drawtime - basetime
elapsed
#> Time difference of 15.50833 hours
Created on 2020-09-09 by the reprex package (v0.3.0)
Because lubridate provides functions to access date components, the elapsed variable can be through hour() and minute().
library(lubridate)
#>
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
#>
#> date, intersect, setdiff, union
basetime <- ymd_hms("2010-12-13 00:00:00")
drawtime <- ymd_hms("2010-12-13 15:30:30")
elapsed <- drawtime - basetime
(hour(drawtime)*60 + minute(drawtime)) / 60
#> [1] 15.5
Created on 2020-09-09 by the reprex package (v0.3.0)
<sup>Created on 2020-09-09 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)</sup>