From de464c4aef2961ce9ad175228368c0a4541e3c94 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 20 Sep 2025 18:30:37 +0530 Subject: [PATCH] docs: dateadd Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../field-types/formula/date-functions.mdx | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/content/docs/fields/field-types/formula/date-functions.mdx b/content/docs/fields/field-types/formula/date-functions.mdx index bbc56185..e6c8e1b0 100644 --- a/content/docs/fields/field-types/formula/date-functions.mdx +++ b/content/docs/fields/field-types/formula/date-functions.mdx @@ -27,28 +27,37 @@ This function compares two dates and returns the difference in the specified uni --- ## DATEADD + The DATEADD function adds a specified value to a date or datetime. #### Syntax + ```plaintext -DATEADD(date | datetime, value, ["day" | "week" | "month" | "year"]) +DATEADD(date | datetime, value, ["second" | "minute" | "hour" | "day" | "week" | "month" | "year"]) ``` #### Sample + ```plaintext -DATEADD('2022-03-14', 1, 'day') => 2022-03-15 -DATEADD('2022-03-14', 1, 'week') => 2022-03-21 -DATEADD('2022-03-14', 1, 'month') => 2022-04-14 -DATEADD('2022-03-14', 1, 'year') => 2023-03-14 +DATEADD('2022-03-14 10:00:00', 30, 'second') => 2022-03-14 10:00:30 +DATEADD('2022-03-14 10:00:00', 15, 'minute') => 2022-03-14 10:15:00 +DATEADD('2022-03-14 10:00:00', 2, 'hour') => 2022-03-14 12:00:00 +DATEADD('2022-03-14', 1, 'day') => 2022-03-15 +DATEADD('2022-03-14', 1, 'week') => 2022-03-21 +DATEADD('2022-03-14', 1, 'month') => 2022-04-14 +DATEADD('2022-03-14', 1, 'year') => 2023-03-14 ``` #### Conditional Example + ```plaintext -IF(NOW() < DATEADD(date, 10, 'day'), "true", "false") => If the current date is less than the specified date plus 10 days, it returns true. Otherwise, it returns false. +IF(NOW() < DATEADD(date, 10, 'day'), "true", "false") +=> If the current date is less than the specified date plus 10 days, it returns true. Otherwise, it returns false. ``` #### Remark -This function supports date and datetime fields and can handle negative values. + +This function supports date and datetime fields, can handle negative values, and works with units down to seconds. ---