Date and time functions (Payflow only)

Note

Use the functions described in this topic in Payflow only

ADDDAYS

Adds a specified number of days to a given date.

Syntax

ADDDAYS(date, n)

Where:

  • date is the date to which you want to add a number of days
  • n is the number of days to add to date

ADDMONTHS

Adds a specified number of months to a given date.

Syntax

ADDMONTHS(date,n)

Where:

  • date is the date to which you want to add a number of months
  • n is the number of months to add to date

ADDYEARS

Adds a specified number of years to a given date.

Syntax

ADDYEARS(date,n)

Where:

  • date is the date to which you want to add a number of years
  • n is the number of years to add to date

DAYSBETWEEN

Returns the number of days between two specified dates.

Syntax

DAYSBETWEEN(date1, date2)

where:

  • date1 is the date at the start of the period.
  • date2 is the date at the end of the period.

Example

DAYSBETWEEN(25/01/2015, 13/04/2015)

returns: 78

...the number of days between 25 January 2015 and 13 April 2015, the result in days of subtracting the earlier date from the later date.

MONTHSBETWEEN

Returns the number of months between two specified dates.

Syntax

MONTHSBETWEEN(date1, date2)

where:

  • date1is the date at the start of the period.
  • date2is the date at the end of the period.

YEARSBETWEEN

Returns the number of years between two specified dates.

Syntax

YEARSBETWEEN(date1, date2)

where:

  • date1 is the date at the start of the period.
  • date2 is the date at the end of the period.

Example

To determine today's age in years of a Team Member:

YEARSBETWEEN(fHCM2__Birth_Date__c, STARTPERIOD(TODAY(),"Yearly",1900-01-01))

  • Returns the number YEARSBETWEEN:

    • The Birth Date
    • The start of the current year: STARTPERIOD(TODAY(),"Yearly",1900-01-01)

STARTPERIOD

Returns the date at the start of the period that includes a date you specify.

Syntax

STARTPERIOD(date, period, base date)

where:

  • date is the date included in the period for which you want the start date.
  • period is one of:

    • Weekly
    • Biweekly
    • Semimonthly
    • Monthly
  • base date is the date used as the starting date for calculating the dates of all subsequent periods. Defaults to 1 January 1900

Examples

To determine today's age in years of a Team Member:

YEARSBETWEEN(fHCM2__Birth_Date__c, STARTPERIOD(TODAY(),"Yearly",1900-01-01))

  • Returns the number YEARSBETWEEN:

    • The Birth Date
    • The start of the current year: STARTPERIOD(TODAY(),"Yearly",1900-01-01)

To return the start of the monthly period that includes a specific date, using a specific base date:

STARTPERIOD(17/07/2015,Monthly,25/01/15)

  • Returns:

    25/06/15

    ...the start of the monthly period including 17 July 2015, given a base date of 25 January 2015.

ENDPERIOD

Returns the date at the start of the period including a date you specify.

Syntax

ENDPERIOD(date, period, base date)

where:

  • date is the date included in the period for which you want the start date.
  • period is one of:

    • Weekly
    • Biweekly
    • Semimonthly
    • Monthly
  • base date is the date used as the starting date for calculating the dates of all subsequent periods. Defaults to 1 January 1900

Example

ENDPERIOD(17/07/2015,Monthly,25/01/2015)

returns:

24/07/2015

...the end of the monthly period including 17 July 2015, given a base date of 25 January 2015.