© Copyright 2024 Clickatell. All rights reserved.
The Date Format action node is used to reformat a date input into another specified format.
This node is typically used after a Request Input node, where a user is required to provide a date or an API call where a date is returned.
If the date was formatted without exceptions, the action node will return "Yes". Else it will return "No", including parse exceptions.
For example, if a user enters a date in yyyy-MM-dd format and we want to convert it into dd-MM-yyyy format, you can use the Date Format node. After a successful conversion, the node will return a "Yes" response. If the conversion failed, the node will return a "No" response.
The table below lists the common letters that can be used to specify the date format patterns in Chat Flow:
Letter | Date or Time Component | Examples |
y | Year | 1996; 96 |
Y | Week year | 2009; 09 |
M | Month in year (context sensitive) | July; Jul; 07 |
L | Month in year (standalone form) | July; Jul; 07 |
w | Week in year | 27 |
W | Week in month | 2 |
D | Day in year | 189 |
d | Day in month | 10 |
F | Day of week in month | 2 |
E | Day name in week | Tuesday; Tue |
u | Day number of week (1 = Monday, ..., 7 = Sunday) | 1 |
a | Am/pm marker | PM |
H | Hour in day (0-23) | 0 |
k | Hour in day (1-24) | 24 |
K | Hour in am/pm (0-11) | 0 |
h | Hour in am/pm (1-12) | 12 |
m | Minute in hour | 30 |
s | Second in minute | 55 |
S | Millisecond | 978 |
z | Timezone | Pacific Standard Time; PST; GMT-08:00 |
Z | Timezone | -08:00 |
X | Timezone | -08; -08:00; -08:00 |