Documentation
How to format date and time
Formatting date and time will be useful for anyone who is having customers in multiple nations and regions. Because the date & time format is not the same in every place. On Botamation platform, you can change the format of the date & time by your need.
Follow the steps below to know how to format date and time for your convenient:
Step 1: Go to the flow that you want edit.
Step 2: Among many options on the builder choose “Action” option and select “Format Date/Date & Time” on the list.
Step 3: Now select the option on the builder to,
- Select the date custom field that contains the date you want to format.
- On the next field enter the format of the date and time you need to change from the default (For example, if you want to display the date and time as “23-01-2022; 02-00 a.m” then you need to enter the format field (without quotation) as “d-m-Y; h-i a”. Refer the table below to know more about the parameters).
- Then, create a new custom field or select the existing one to store the changed date & time format on “Save the formatted date to” field.
- In addition, you can choose the time zone of this formatted date & time for page (or) user’s time zone.
Here is the demo link flow: Click Here
Table explaining the parameters of the date & time formats:
Character | Description | Values |
Day | — | — |
d | Day of the month, 2 digits with leading zeros | 01 to 31 |
D | A textual representation of a day, three letters | Mon through Sun |
j | Day of the month without leading zeros | 1 to 31 |
l (lowercase ‘L’) | A full textual representation of the day of the week | Sunday through Saturday |
N | ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0) | 1 (for Monday) through 7 (for Sunday) |
S | English ordinal suffix for the day of the month, 2 characters | st, nd, rd or th. Works well with j |
w | Numeric representation of the day of the week | 0 (for Sunday) through 6 (for Saturday) |
z | The day of the year (starting from 0) | 0 through 365 |
Week | — | — |
W | ISO-8601 week number of year, weeks starting on Monday | Example: 42 (the 42nd week in the year) |
Month | — | — |
F | A full textual representation of a month, such as January or March | January through December |
m | Numeric representation of a month, with leading zeros | 01 through 12 |
M | A short textual representation of a month, three letters | Jan through Dec |
n | Numeric representation of a month, without leading zeros | 1 through 12 |
t | Number of days in the given month | 28 through 31 |
Year | — | — |
L | Whether it’s a leap year | 1 if it is a leap year, 0 otherwise. |
o | ISO-8601 week-numbering year. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0) | Examples: 1999 or 2003 |
Y | A full numeric representation of a year, 4 digits | Examples: 1999 or 2003 |
y | A two-digit representation of a year | Examples: 99 or 03 |
Time | — | — |
a | Lowercase Ante meridiem and Post meridiem | am or pm |
A | Uppercase Ante meridiem and Post meridiem | AM or PM |
g | 12-hour format of an hour without leading zeros | 1 through 12 |
G | 24-hour format of an hour without leading zeros | 0 through 23 |
h | 12-hour format of an hour with leading zeros | 01 through 12 |
H | 24-hour format of an hour with leading zeros | 00 through 23 |
i | Minutes with leading zeros | 00 to 59 |
s | Seconds with leading zeros | 00 through 59 |
U | Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). This format is very important because it allows you to get the date as total of seconds. With seconds you can do a lot of maths. For example a quiz bot would save the start date a user starts the quiz and also save the date the user finishes the quiz. The bot would calculate the total minutes the user takes to finish the quiz with ({{stop}} – {{start}})/60. |