Format date and time
Choose a date field, output format and timezone for a formatted value.
Use Format Date/Date & Time to turn a stored date into the text format needed by a message or workflow. Keep the source date and save the formatted result in a separate field.
The earlier guide documents the steps below. Confirm the action and timezone controls in your current account before using the result in a customer flow.
Configure the action
- Open the intended flow in Flow Builder.
- Add an Action and select Format Date/Date & Time.
- Select the date custom field containing the source value.
- Enter the format string.
- Under Save the formatted date to, select or create the field that will hold the result.
- Choose the Page or user's timezone, as appropriate for the workflow, then save.
The earlier guide offers Page and user timezone choices. Check which timezone is actually configured and whether a user timezone is available. For Malaysian workflows, confirm the chosen timezone and output with a known date, including a time near midnight. Changing the display format alone does not establish which timezone was applied.
Format example
The source uses this format string:
d-m-Y; h-i a
For 23 January 2022 at 2:00 am in the selected timezone, the PHP-style tokens describe 23-01-2022; 02-00 am. The a token represents am or pm; it does not add periods. Verify the actual Bual Pro output before using a format in a live message.
Format-token reference
These tokens are transcribed from the earlier guide's tables. They follow the PHP-style date formatting reference. Current support for every token in Bual Pro has not been runtime-tested; use the tokens your action accepts.
Day and week
| Token | Meaning |
|---|---|
d | Day of month with a leading zero, 01 to 31. |
D | Three-letter day name, Mon to Sun. |
j | Day of month without a leading zero, 1 to 31. |
l | Full day name, Sunday to Saturday; this is a lowercase letter L. |
N | ISO weekday number, Monday 1 to Sunday 7. |
S | English ordinal suffix: st, nd, rd or th. |
w | Weekday number, Sunday 0 to Saturday 6. |
z | Day of year starting from 0. |
W | ISO week number; weeks start on Monday. |
Month and year
| Token | Meaning |
|---|---|
F | Full month name, January to December. |
m | Month with a leading zero, 01 to 12. |
M | Three-letter month name, Jan to Dec. |
n | Month without a leading zero, 1 to 12. |
t | Number of days in the month. |
L | Leap-year indicator: 1 for a leap year, otherwise 0. |
o | ISO week-numbering year; this may differ from the calendar year near New Year. |
Y | Four-digit calendar year. |
y | Two-digit calendar year. |
Time and timestamp
| Token | Meaning |
|---|---|
a | Lowercase am or pm. |
A | Uppercase AM or PM. |
g | 12-hour time without a leading zero, 1 to 12. |
G | 24-hour time without a leading zero, 0 to 23. |
h | 12-hour time with a leading zero, 01 to 12. |
H | 24-hour time with a leading zero, 00 to 23. |
i | Minutes with a leading zero, 00 to 59. |
s | Seconds with a leading zero, 00 to 59. |
U | Seconds since the Unix epoch, 1 January 1970 at 00:00:00 UTC. |
See the PHP date-format reference for token definitions. That reference does not establish which PHP version or tokens Bual Pro implements.
Use the result in a flow
Insert the destination field through the field picker in the message or action that needs the formatted text. Keep calculations on numeric timestamps separate from display formatting. If start and stop values are Unix seconds, elapsed minutes are calculated as (stop - start) / 60; confirm the input units before using this calculation.
Review timestamp conversion, custom fields and math calculations for related steps.