Operations (sample payloads)
Main operationsCopy
Add to dateCopy
Add a number of duration types to a time value. Returns a UTC ISO string.
Sample Input
1{2"date": "2023-05-15T10:30:00Z",3"years": 1,4"months": 2,5"weeks": 3,6"days": 4,7"business_days": 5,8"hours": 6,9"minutes": 7,10"seconds": 811}
Sample Output
1{2"result": "2024-08-12T16:37:08Z"3}
Compare datesCopy
Compare two date/time values.
Sample Input
1{2"date_a": "2023-05-15T10:30:00Z",3"comparison": "IS BEFORE",4"date_b": "2023-05-16T09:45:00Z",5"resolution": "day"6}
Sample Output
1{2"result": true3}
Compare timesCopy
Compare two time values, ignoring the dates/days.
Sample Input
1{2"datetime": "2023-05-15T14:30:00Z",3"comparison": "IS BEFORE",4"time": {5"hour": "15",6"minute": "00",7"second": "00"8},9"timezone": "America/New_York",10"include_seconds": true11}
Sample Output
1{2"result": true3}
Date is in the last...Copy
Allows you to easily check if a given date has occurred in the last X number of seconds, minutes, hours, or days.
Sample Input
1{2"date": "2023-05-15T10:30:00Z",3"in_last": 2,4"in_last_unit": "days"5}
Sample Output
1{2"result": true3}
Format dateCopy
Format date to a desired format.
Sample Input
1{2"date": "2023-05-15T14:30:00Z",3"format": {4"existing_format": "YYYY-MM-DD HH:mm:ss Z"5},6"timezone": "America/New_York"7}
Sample Output
1{2"result": "2023-05-15 10:30:00 -0400"3}
Get current timestampCopy
Returns the current date and time in a date string format (ISO 8601).
Sample Input
1{2"timezone": "America/New_York",3"format": {4"existing_format": "YYYY-MM-DDTHH:mm:ssZ"5}6}
Sample Output
1{2"result": "2023-05-15T14:30:45-0400"3}
Get date propertyCopy
Returns a number value from a date, such as the year, the day of the month, or the hour of the day.
Sample Input
1{2"date": "2023-05-15T14:30:45Z",3"parameter": "month"4}
Sample Output
1{2"result": 53}
Get day of weekCopy
Returns the day of the week for a given date. e.g. "Saturday" or "Tuesday"
Sample Input
1{2"date": "2023-05-15T14:30:00Z",3"timezone": "America/New_York"4}
Sample Output
1{2"result": "Monday"3}
Get days betweenCopy
Get the number of days between two dates, rounded to the nearest day. If the second date is before the first date, the result will be negative.
Sample Input
1{2"date1": "2023-05-01T00:00:00Z",3"date2": "2023-05-15T12:30:00Z"4}
Sample Output
1{2"result": 143}
Get durationCopy
Given a total number of seconds, minutes, etc - return human readable text containing how long the duration was approximately, in the units of your choosing.
Sample Input
1{2"duration": 7200,3"unit_type": "seconds"4}
Sample Output
1{2"result": "2 hours"3}
Get time betweenCopy
Get the time between two dates, as hh:mm:ss. If the second date is before the first date, the result will be negative.
Sample Input
1{2"start_date": "2023-05-01T09:00:00Z",3"end_date": "2023-05-03T15:30:45Z"4}
Sample Output
1{2"result": {3"years": 0,4"months": 0,5"days": 2,6"hours": 6,7"minutes": 30,8"seconds": 45,9"milliseconds": 010}11}
Get time from nowCopy
Returns a human readable date relative to the current time, such as "in 2 months", or "4 days ago".
Sample Input
1{2"date": "2023-07-15T10:30:00Z"3}
Sample Output
1{2"result": "in 2 months"3}
Is between dates?Copy
Check to see whether a date falls within a date range
Sample Input
1{2"date": "2023-05-15T10:30:00Z",3"start_date": "2023-05-01T00:00:00Z",4"end_date": "2023-05-31T23:59:59Z",5"inclusive": true,6"resolution": "day"7}
Sample Output
1{2"result": true3}
Is between times?Copy
Check to see whether a time falls within a time range, ignoring the dates/days.
Sample Input
1{2"datetime": "2023-05-15T14:30:00Z",3"start_time": {4"hour": "09",5"minute": "00",6"second": "00"7},8"end_time": {9"hour": "18",10"minute": "00",11"second": "00"12},13"timezone": "America/New_York",14"include_seconds": true,15"inclusive": true16}
Sample Output
1{2"result": true3}
Is business hours?Copy
Check to see if it's business hours or not, given a date in a given timezone.
Sample Input
1{2"date": "2023-05-15T14:30:00Z",3"week_start": "1",4"week_end": "5",5"hours_start": {6"hour": "09",7"minute": "00"8},9"hours_end": {10"hour": "17",11"minute": "00"12},13"timezone": "America/New_York"14}
Sample Output
1{2"result": true3}
Is weekend?Copy
Check to see if it's the weekend or not, given a date in a given timezone.
Sample Input
1{2"date": "2023-05-20T14:30:00Z",3"timezone": "America/New_York"4}
Sample Output
1{2"result": true3}
Minus from dateCopy
Subtract a number of duration types from a time value. Returns a UTC ISO string.
Sample Input
1{2"date": "2023-05-15T10:30:00Z",3"years": 1,4"months": 2,5"weeks": 3,6"days": 4,7"business_days": 5,8"hours": 6,9"minutes": 7,10"seconds": 811}
Sample Output
1{2"result": "2022-02-28T04:22:52Z"3}