How to format date and time

You are here:
Estimated reading time: 2 min

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 Chatrace 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:

CharacterDescriptionValues
Day
dDay of the month, 2 digits with leading zeros01 to 31
DA textual representation of a day, three lettersMon through Sun
jDay of the month without leading zeros1 to 31
l (lowercase ‘L’)A full textual representation of the day of the weekSunday through Saturday
NISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)1 (for Monday) through 7 (for Sunday)
SEnglish ordinal suffix for the day of the month, 2 charactersst, nd, rd or th. Works well with j
wNumeric representation of the day of the week0 (for Sunday) through 6 (for Saturday)
zThe day of the year (starting from 0)0 through 365
Week
WISO-8601 week number of year, weeks starting on MondayExample: 42 (the 42nd week in the year)
Month
FA full textual representation of a month, such as January or MarchJanuary through December
mNumeric representation of a month, with leading zeros01 through 12
MA short textual representation of a month, three lettersJan through Dec
nNumeric representation of a month, without leading zeros1 through 12
tNumber of days in the given month28 through 31
Year
LWhether it’s a leap year1 if it is a leap year, 0 otherwise.
oISO-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
YA full numeric representation of a year, 4 digitsExamples: 1999 or 2003
yA two-digit representation of a yearExamples: 99 or 03
Time
aLowercase Ante meridiem and Post meridiemam or pm
AUppercase Ante meridiem and Post meridiemAM or PM
g12-hour format of an hour without leading zeros1 through 12
G24-hour format of an hour without leading zeros0 through 23
h12-hour format of an hour with leading zeros01 through 12
H24-hour format of an hour with leading zeros00 through 23
iMinutes with leading zeros00 to 59
sSeconds with leading zeros00 through 59
USeconds 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.

You can download a flow that uses the Format date feature here.

Was this article helpful?
Dislike 0
Views: 2730