dateBuild¶
Builds a date String based on the specified pattern and date units.
Parameters¶
Combine the parameters as a JSON structure as input.
Parameter |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
pattern |
Mandatory |
String |
The format of the returned date. |
year |
Optional |
String |
The year in yyyy format (for example: 2021). If none or an invalid value is specified, |
month |
Optional |
String |
The month in number format (for example: 1 for January, 2 for February, etc.). If none or an invalid value is specified, |
dayofmonth |
Optional |
String |
The day of the month in number format (for example: 1 for the first day of the month, 2 for the second day of the month, etc.). If none or an invalid value is specified, |
timezone |
Optional |
String |
The timezone for the returned date/time, such as GMT for Greenwich Mean Time. If not specified, GMT is used by default. |
locale |
Optional |
String |
|
Return Values¶
Value |
Data Type |
Description |
---|---|---|
value |
String |
The date built according to |
Samples¶
var format = tools.DateUtil.dateBuild({"month":"11","year":"2000","timezone":"GMT","pattern":"EEE yyyy-MM-dd hh:mm:ss","dayofmonth":"13","locale":"CH"});
return tools.resultBuilder.build(true, JSON.stringify(format));
Output
"Mon 2000-11-13 04:40:13"