Excerpt | ||
---|---|---|
| ||
dateSet(date, dateField, dateValue) Sets an element of a date (e.g. the month) and returns the new date. |
Function: dateSet()
Sets an element of a date (e.g. the month) , such as the day or month, and returns the new date.
Syntax
dateSet(date,dateField,dateValue)
Argument | TypeDescription | |||||
---|---|---|---|---|---|---|
date | DateThe original date /time | dateField | Date Field | The part or date-time. For the current date-time use the attribute function now(). | See Date-Time Functions for details about the arguments. | |
dateField | The element of the date to be be changed (e.g. , for example the month or seconds). | |||||
dateValue | Date 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.
...
. |
Tip |
---|
Changing a date-time to a different
|
Examples
Example | Returns |
---|---|
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) |
...
. An invoice date of "20100303.162359" |
...
becomes "20100103.162359" |
dateSet("in.invoiceDate",_SECOND, |
...
0) | Returns in.invoiceDate with the seconds set to 0. |
...
An invoice date-time of "20100303.162359" |
...
becomes "20100303.162300" |
...
. |
dateSet(toDate("20131205"), |
...
_DAY_OF_WEEK, |
...
_TUESDAY) | The input date of "20131205" is a Thursday |
...
. This returns the date for the Tuesday in the same week, "20131203". |
dateSet(toDate("20131205"), |
...
_DAY_OF_WEEK, |
...
_SATURDAY) | The input date of "20131205" is a Thursday |
...
. This returns the date for the Saturday in the same week "20131207". |
See Also
Excerpt | ||
---|---|---|
| ||
dateSet(date, dateField, dateValue) Sets an element of a date (e.g. the month) and returns the new date. |