doo.functions.date

 

The functions give you powerful tools to work with dates and times. They make it easy to create, change, and compare dates. With these functions, you can manage time-related information effectively, adapt it to your needs, and get useful data for your apps and tasks. Functions can also be used in the Calculated field type.

NEWDATE

Returns a Date instance parsed from the input parameter or a Date instance with current date-time if the input parameter is not passed. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

NEWDATE('2023-12-31T23:00:00Z') returns Date with UTC time 2023-12-31 23:00:00; newdate('2024-01-01T00:00:00') (note there is no time zone specified in the date-time string) returns Date with UTC time 2023-12-31 23:00:00 for time zone Europe/Paris (GMT+1), but returns 2024-01-01 00:00:00 for time zone Europe/London (UTC/GMT+0)

ADDINTERVAL

Add specified interval to the input value (Date/string -> returns the same datatype Date/string). The value can be either positive or negative. Supported intervals: milliseconds, seconds, minutes, hours, days, months, years.

Example

ADDINTERVAL('2024-01-20T14:55:00', 'minutes', 2) => '2024-01-20T14:57:00'

ADDDAYS

Add a number of days to the input value (Date/string -> returns the same datatype Date/string). The number of days can be either positive or negative.

Example

ADDDAYS('2024-01-20', -5) => '2024-01-15'

ADDMONTHS

Use to add or subtract months from a date.

Example

ADDMONTHS('2024-01-20', 1) => '2024-02-20'

ADDYEARS

Use to add or subtract years from a date.

Example

ADDYEARS('2024-01-20', -1) => '2023-01-20'

MINDATE

Returns the lowest date.

Example

MINDATE('2021-01-01', '2022-01-01') => '2021-01-01'

MAXDATE

Returns the largest date.

Example

MAXDATE('2021-01-01', '2022-01-01') => '2022-01-01'

DIFF

unit - seconds, minutes, hours, days. months and years not supported. Returns number - float. Not integer (whole number)

Example

DIFF('2024-01-25', '2024-01-27', 'days') => 2
Returns part of the date. Year as a number. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

YEAR

Returns part of the date. Year as a number. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

YEAR('2023-12-31T23:00:00Z') returns 2024 for time zone Europe/Paris (GMT+1), but returns 2023 for time zone Europe/London (UTC/GMT+0) or America/New_York (GMT-5)

MONTH

Returns part of the date. Month as a number. Ranging from 1 (January) to 12 (December). You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

MONTH('2023-12-31T23:00:00Z') returns 1 for time zone Europe/Paris (GMT+1), but returns 12 for time zone Europe/London (UTC/GMT+0) or America/New_York (GMT-5)

WEEKISO

Returns part of the date. ISO week of the year as a number. Ranging from 1 (Sunday) to 7 (Saturday). You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

WEEKISO('2023-12-31T23:00:00Z') returns 1 for time zone Europe/Paris (GMT+1), but returns 52 for time zone Europe/London (UTC/GMT+0) or America/New_York (GMT-5)

DAY

Returns part of the date. Day 1-31 as a number. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

DAY('2023-12-31T23:00:00Z') returns 1 for time zone Europe/Paris (GMT+1), but returns 31 for time zone Europe/London (UTC/GMT+0) or America/New_York (GMT-5)

MAX

Returns the largest date.

Example

MAX('2021-01-01', '2022-01-01') => '2022-01-01'

MIN

Returns the largest date.

 Example

MIN('2021-01-01', '2022-01-01') => '2022-01-01'

HOUR

Returns part of the date. Hour 0-23 as a number. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

HOUR('2023-12-31T23:00:00Z') returns 0 for time zone Europe/Paris (GMT+1), but returns 23 for time zone Europe/London (UTC/GMT+0) and returns 18 for time zone America/New_York (GMT-5)

MINUTE

Returns part of the date. Minutes 0-59 as a number. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

MINUTE('2023-12-31T23:00:00Z') returns 0 for time zone Europe/Paris (GMT+1), but returns 30 for time zone Canada/Newfoundland (GMT-2:30) and returns 45 for time zone Australia/Eucla (GMT+8:45)

WEEKDAY

Returns part of the date. Weekday as a number. Ranging from 1 (Sunday) to 7 (Saturday). You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

WEEKDAY('2023-12-31T23:00:00Z') returns 2 for time zone Europe/Paris (GMT+1), but returns 1 for time zone Europe/London (UTC/GMT+0) or America/New_York (GMT-5)

WEEKDAYISO

Returns part of the date. ISO day of the week as a number. Ranging from 1 (Monday) to 7 (Sunday). You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

WEEKDAYISO('2023-12-31T23:00:00Z') returns 1 for time zone Europe/Paris (GMT+1), but returns 7 for time zone Europe/London (UTC/GMT+0) or America/New_York (GMT-5)

TODATESTRINGISO

Returns date-part only string in ISO format yyyy-MM-dd. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

TODATESTRINGISO('2023-12-31T23:00:00Z') returns '2024-01-01' for time zone Europe/Paris (GMT+1), but returns '2023-12-31' for time zone Europe/London (UTC/GMT+0) or America/New_York (GMT-5)

TODATESTRINGAPP

Returns date-part only string in format specified in the current application. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

TODATESTRINGAPP('2023-12-31T23:00:00Z') (app. format 'dd.MM.yyyy') returns '01.01.2024' for time zone Europe/Paris (GMT+1), but returns '31.12.2023' for time zone Europe/London (UTC/GMT+0) or America/New_York (GMT-5)

TODATETIMESTRINGAPP

Returns date-time string in format specified in the current application. You can specify the time zone (e.g. Europe/Paris or UTC, respects DST, timeZone parameter is not supported in calculated fields). The default time zone is taken from the current application.

Example

TODATETIMESTRINGAPP('2023-12-31T23:00:00Z') (app. format 'dd.MM.yyyy' and 24h time) returns '01.01.2024 00:00' for time zone Europe/Paris (GMT+1), but returns '31.12.2023 19:30' for time zone Canada/Newfoundland (GMT-2:30) and returns '01.01.2024 07:45' for time zone Australia/Eucla (GMT+8:45)