dateTimeFormat¶
Converts a date/time (String) from one format to another.
Parameters¶
Combine the parameters as a JSON structure as input.
Parameter | Mandatory/Optional | Data Type | Description |
---|---|---|---|
inString | Mandatory | String | The date/time to convert. |
currentPattern | Mandatory | String | The inString format. |
newPattern | Mandatory | String | The format to convert inString to. |
locale | Optional | String |
|
lenient | Mandatory | String |
|
Return Values¶
Value | Data Type | Description |
---|---|---|
value | String | The inString date in the format as per specified in newPattern . |
Samples¶
var format = tools.DateUtil.dateTimeFormat({"inString":"2021-04-01 05:13:02","currentPattern":"yyyy-MM-dd hh:mm:ss","newPattern":"EEE dd MMM YYYY hh:mm:ss","lenient":true,"locale":"EN"});
return tools.resultBuilder.build(true, JSON.stringify(format));
Output
"Thu 01 Apr 2021 05:13:02"