duration(a - b, format c)


Returns the duration between two dates b and a in time unit c.

Description of Parameters


Parameter

Description

a

Date.

b

Date.

c

Unit (y, M, d, h, m, s, S).

Possible Units for Parameter c


Value

Time Unit

milli or S

Milliseconds.

sec or s

Seconds.

min or m

Minutes.

hour or H

Hours.

day or d

Days.

month or M

Months.

year or y

Years.

Examples


Parameter a

Parameter b

Parameter c

Result

2010-03-01 00:00:00

2010-03-15 00:00:00

d

-14

2010-03-15 00:00:00

2010-03-01 00:00:00

d

14

2010-03-01 00:00:00

2010-03-15 00:00:00

h

-336

2010-03-15 00:00:00

2010-03-01 00:00:00

h

336