Skip to main content

Time

add-time

time time seconds decimal  time

time time seconds integer  time

Add SECONDS to TIME; SECONDS can be integer or decimal.

pact> (add-time (time "2016-07-22T12:00:00Z") 15)"2016-07-22T12:00:15Z"
pact> (add-time (time "2016-07-22T12:00:00Z") 15)"2016-07-22T12:00:15Z"

days

n decimal  decimal

n integer  decimal

N days, for use with 'add-time'

pact> (add-time (time "2016-07-22T12:00:00Z") (days 1))"2016-07-23T12:00:00Z"
pact> (add-time (time "2016-07-22T12:00:00Z") (days 1))"2016-07-23T12:00:00Z"

diff-time

time1 time time2 time  decimal

Compute difference between TIME1 and TIME2 in seconds.

pact> (diff-time (parse-time "%T" "16:00:00") (parse-time "%T" "09:30:00"))23400.0
pact> (diff-time (parse-time "%T" "16:00:00") (parse-time "%T" "09:30:00"))23400.0

format-time

format string time time  string

Format TIME using FORMAT. See "Time Formats" docs for supported formats.

pact> (format-time "%F" (time "2016-07-22T12:00:00Z"))"2016-07-22"
pact> (format-time "%F" (time "2016-07-22T12:00:00Z"))"2016-07-22"

hours

n decimal  decimal

n integer  decimal

N hours, for use with 'add-time'

pact> (add-time (time "2016-07-22T12:00:00Z") (hours 1))"2016-07-22T13:00:00Z"
pact> (add-time (time "2016-07-22T12:00:00Z") (hours 1))"2016-07-22T13:00:00Z"

minutes

n decimal  decimal

n integer  decimal

N minutes, for use with 'add-time'.

pact> (add-time (time "2016-07-22T12:00:00Z") (minutes 1))"2016-07-22T12:01:00Z"
pact> (add-time (time "2016-07-22T12:00:00Z") (minutes 1))"2016-07-22T12:01:00Z"

parse-time

format string utcval string  time

Construct time from UTCVAL using FORMAT. See "Time Formats" docs for supported formats.

pact> (parse-time "%F" "2016-09-12")"2016-09-12T00:00:00Z"
pact> (parse-time "%F" "2016-09-12")"2016-09-12T00:00:00Z"

time

utcval string  time

Construct time from UTCVAL using ISO8601 format (%Y-%m-%dT%H:%M:%SZ).

pact> (time "2016-07-22T11:26:35Z")"2016-07-22T11:26:35Z"
pact> (time "2016-07-22T11:26:35Z")"2016-07-22T11:26:35Z"

Receive important developer updates