make_difftime() creates a difftime object with the specified number of units. Entries for different units are cumulative. difftime displays durations in various units, but these units are estimates given for convenience. The underlying object is always recorded as a fixed number of seconds.

make_difftime(num = NULL, units = "auto", ...)

## Arguments

num Optional number of seconds a character vector that lists the type of units to use for the display of the return value (see examples). If units is "auto" (the default) the display units are computed automatically. This might create undesirable effects when converting difftime objects to numeric values in data processing. a list of time units to be included in the difftime and their amounts. Seconds, minutes, hours, days, and weeks are supported. Normally only one of num or ... are present. If both are present, the difftime objects are concatenated.

## Value

a difftime object

## Details

Conceptually, difftime objects are a type of duration. They measure the exact passage of time but do not always align with measurements made in larger units of time such as hours, months and years. This is because the length of larger time units can be affected by conventions such as leap years and Daylight Savings Time. lubridate provides a second class for measuring durations, the Duration class.

duration(), as.duration()
make_difftime(1)#> Time difference of 1 secsmake_difftime(60)#> Time difference of 1 minsmake_difftime(3600)#> Time difference of 1 hoursmake_difftime(3600, units = "minute")#> Time difference of 60 mins# Time difference of 60 mins
#> [1]     2 -1440# Time differences in mins