Share
Explore

icon picker
Date Functions Pack Usage Document


megaphone

How to use the Pack functions


Function Documentation

1. AddMonths

Description: Adds a specified number of months to a given date.
Parameters:
date (Date): The starting date from which to add months.
months (Number): The number of months to add to the date. Can be positive (to move forward) or negative (to move backward).
Returns: The resulting date as a string in ISO format (YYYY-MM-DDTHH:MM:SS.sssZ), treated as a date in Coda.
Example:
Input: AddMonths("2024-01-15", 2)
Output:
3/15/2024 1:00 AM

2. AddYears

Description: Adds a specified number of years to a given date.
Parameters:
date (Date): The starting date from which to add years.
years (Number): The number of years to add to the date. Can be positive (to move forward) or negative (to move backward).
Returns: The resulting date as a string in ISO format (YYYY-MM-DDTHH:MM:SS.sssZ), treated as a date in Coda.
Example:
Input: AddYears(Today(), 1)
Output:
11/8/2025

3. BeginningOfMonth

Description: Gets the first day of the month for a given date.
Parameters:
date (Date): The date for which to find the first day of the month.
Returns: The first day of the month as a string in ISO format (YYYY-MM-DDTHH:MM:SS.sssZ), treated as a date in Coda.
Example:
Input: BeginningOfMonth(Today())
Output:
11/1/2024 1:00 AM

4. EndOfMonth

Description: Gets the last day of the month for a given date.
Parameters:
date (Date): The date for which to find the last day of the month.
Returns: The last day of the month as a string in ISO format (YYYY-MM-DDTHH:MM:SS.sssZ), treated as a date in Coda.
Example:
Input: EndOfMonth(Today())
Output:
11/30/2024

5. BeginningOfQuarter

Description: Gets the first day of the quarter for a given date.
Parameters:
date (Date): The date for which to find the first day of the quarter.
Returns: The first day of the quarter as a string in ISO format (YYYY-MM-DDTHH:MM:SS.sssZ), treated as a date in Coda.
Example:
Input: BeginningOfQuarter(Today())
Output:
10/1/2024 1:00 AM
Explanation: May 15 falls in the second quarter (April - June), so the function returns April 1 as the start of the quarter.

6. EndOfQuarter

Description: Gets the last day of the quarter for a given date.
Parameters:
date (Date): The date for which to find the last day of the quarter.
Returns: The last day of the quarter as a string in ISO format (YYYY-MM-DDTHH:MM:SS.sssZ), treated as a date in Coda.
Example:
Input: EndOfQuarter(Today())
Output:
12/31/2024
Explanation: May 15 falls in the second quarter (April - June), so the function returns June 30 as the end of the quarter.

General Notes

Date Input Format: The functions expect dates in ISO string format (e.g., "2024-05-15"). If using dates from Coda, this should work seamlessly as Coda automatically parses dates to ISO format.
Date Output Format: All functions return dates in ISO format (YYYY-MM-DDTHH:MM:SS.sssZ). This format ensures compatibility with Coda's date handling, so Coda will treat the output as dates.
Time Zone: The output will always be in UTC (Z at the end), which is the standard for ISO strings. Coda should handle these correctly as date objects, regardless of the time zone.
These functions can be helpful in recurring task management, reporting, or any scenario that requires date calculations based on months, quarters, or years.

Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.