PhixFlow Help

dateSet

Function: dateSet()

Sets an element of a date (e.g. the month) and returns the new date.

Syntax

dateSet(date, dateField, dateValue)

ArgumentTypeDescription
dateDateThe original date/time
dateFieldDate FieldThe part of the date to be be changed (e.g. the month or seconds)
dateValueDate ValueThe new value for that date element

When updating the day of the week (e.g. to _SATURDAY), the result will be the date for that day of the week in the current week - and weeks being on Monday. See examples below.

Examples

dateSet("20100403.162359", _MONTH, 3)

Sets the month to 3 so returns the date/time "20100303.162359"

dateSet("in.invoiceDate", _MONTH, _JANUARY)

Returns in.invoiceDate with the month set to 1 (January) e.g. "20100303.162359" would become "20100103.162359"

dateSet("in.invoiceDate",_SECOND, 0)

Returns in.invoiceDate with the seconds set to 0. e.g. "20100303.162359" would become e.g. "20100303.162300".

Remember, when updating the day of the week, the resulting date will be that day of the week in the current week, and weeks begin on Monday. For example, if you use an input date which is a Thursday, setting the day of the week to Monday, Tuesday or Wednesday will give you an ealier date than the input; setting the day of the week to Friday, Saturday or Sunday will give you a later date than the input.

dateSet(toDate("20131205"), _DAY_OF_WEEK, _TUESDAY)

The input date 20131205 is a Thursday, so this will give 20131203.

dateSet(toDate("20131205"), _DAY_OF_WEEK, _SATURDAY)

The input date 20131205 is a Thursday, so this will give 20131207.

See Also

Please let us know if we could improve this page feedback@phixflow.com