How to identify the length of time between two dates in R

If you are finding the length of time (in hours) between two columns of dates in a dataframe:

> df$yourLength <- round(int_length(interval( df$yourStartTime, df$yourEndTIme)) / 60 / 60, digits = 2)
[1] [interval lengths]

… or …

If you are finding the length of time (in hours) between two datetimes in standard text form:

> yourLength = round(int_length(interval(“2020-1-1 12:30:00”, “2020-1-2 2:45:00”)) / 60 / 60, digits = 2)
[1] 14.25

Note: This solution requires the lubridate package.

Explanation:

int_length returns the number of seconds between two dates in an interval. You must divide the number of seconds by 60 to get the number of minutes in the interval and again by 60 to get the number of hours in the interval. You could also get the number of hours by dividing the return value of int_length by 120.

 
0
Kudos
 
0
Kudos

Now read this

How to display the IPv6 Neighbor Discovery Table in Windows

To display the Neighbor Discovery Table (ND Table) in Windows enter the following into the command prompt: > netsh interface ipv6 show neighbors On your local machine, windows maps IPv6 addresses to physical addresses (MAC addresses)... Continue →