Date Functions

Updated 3 years ago by dustin keir

Use date functions to manipulate date fields in formula user-defined fields and in rules for mandatory user-defined fields. When you use date functions, you can use date fields as the parameters for the function or you can supply date values for the functions. When you supply date values, use the Date function to format the values as dates.

You can add the following functions to formulas using date fields.

  • Date – Converts integers to date values.
  • Day – Returns the day of the month as an integer from a date value.
  • Dayofweek – Returns the day of the week expressed as an integer.
  • Month – Returns the month as an integer from a date value.
  • Year – Returns the year as an integer from a date value.

Date

Any formula that supplies an invalid date to the Date function will result in a blank value. For example, the function “Date (2012, 4, 31)” is invalid since the month of April does not have 31 days. If this function is part of a larger compound expression, the entire expression will evaluate to blank.

Converts integers to date values.

Syntax

Date(Year, Month, Day)

Parameters

Parameter

Data Type

Description

Year

Integer

The four-digit year.

Month

Integer

The one- or two-digit month.

Day

Integer

The one- or two-digit day.

Example

Date(2009, 7, 9)
  • This example returns July 9, 2009 as the date value.

Day

Returns the day of the month as an integer from a date value.

Syntax

Day(Date)

Parameters

Parameter

Data Type

Description

Date

Date

The date to return the day for.

Examples

Day(Date(2009, 7, 9))
  • This example returns 9 as the day of the month in the date value.
Day([Creation Date])
  • This example returns the day of the month that an entry was created.

Dayofweek

Returns the day of the week expressed as an integer for a specified date value, with 1 = Sunday, 2 = Monday, 3 = Tuesday, and so on.

Syntax

Dayofweek(Date)

Parameters

Parameter

Data Type

Description

Date

Date

The date value for which to return the day of the week.

Examples

Dayofweek(Date(2009, 7, 9)
  • This example returns 5, for Thursday, as the day of the week for the given date.
Dayofweek([Creation Date])
  • This example returns the day of the week that an entry was created.

Month

Returns the month as an integer from a date value.

Syntax

Month(Date)

Parameters

Parameter

Data Type

Description

Date

Date

The date from which to return the month.

Examples

Month(Date(2009, 7, 9))
  • This example returns 7, for July, as the month in the date value.
Month([Creation Date])
  • This example returns the month that an entry was created.

Year

Returns the year as an integer from a date value.

Syntax

Year(Date)

Parameters

Parameter

Data Type

Description

Date

Date

Date value for which to return the year.

Examples

Year(Date(2009, 7, 9))
  • This example returns 2009 as the year for the date value.
Year([Creation Date])
  • This example returns the year that an entry was created.


How did we do?