Round date to month

The round date to month policy masks a date by rounding the date to the first day of the original month. For example, August 21 would round to August 1. The format of the generated date will match the input date.

JavaScript policy syntax

This policy is available with the function DateMask.roundDateToMonth().

DateMask.roundDateToMonth(record.getItem(<arg:inputAttribute>), <arg:dateFormat>)

For example, to round a date to the first day of the month in MM-dd-yyyy format, enter the following syntax:

DateMask.roundDateToMonth(record.getItem('/DEMO/ORDERS/ORDER_DATE'), 'MM-dd-yyyy')

Argument Description
inputAttribute The source attribute containing the date to mask.
dateFormat The format of the date. The default is yyyy-MM-dd. The following formats are supported:
  • dd-MM-yyyy
  • dd-MM-yyyy HH:mm:ss
  • MM-dd-yyyy
  • MM-dd-yyyy HH:mm:ss
  • MMM dd, yyyy
  • yyyy-MM-dd