datetime.diff

This function returns the difference between two specified datetime values.

Syntax

datetime.diff(start, end, type)

Arguments

Argument

Type

Description

start

datetime

Start date and time.

end

datetime

End date and time.

type

string

The difference is controlled by the argument type, in (days, hours, mins, and seconds).

Returns

Type

Description

float64

Difference between the two specified datetime values.

Examples

The function datetime.diff(datetime.current(), datetime.addHours(datetime.current(), 2), "hours") returns 2.