Everything you need to know to display and manipulate dates and schedules with bn_date
Here is how to easily manipulate the date variables to customize your chatbots even more.
These “magic” variables are processed dynamically in the display and in the conditions.
It becomes very easy to say “good evening” instead of “good morning”, to answer that the physical store is closed this Sunday, but will be open next Tuesday etc…
Here is the list of “magic” variables reserved for dates:
As a preamble, let’s clarify something you often ask us! We count these 2 types of variables:
- bn_date
- calendar_day
Each has its own purpose and should not be confused.
In the case that interests us here, the system variables linked to dates, the type {{BN_DATE}} represents variables that call for information that the system transmits to us. This will observe the following mechanics:
User: “What time is it please”?
Chatbot: “14:08”
Obviously, when the user asks the question again 10 minutes later, the information will have evolved and the chatbot will answer “2:18 pm” and so on.
If you use the variable in this way: {{bn_date_TodayYMDT}}, the chatbot will display the date in “computer” (database) + time format: “2020/06/27 21:10”
They are dynamic in short!
Now that you understand the subtlety, we invite you to check out the rest š
{{bn_date_minute}}
Minute (01…60)
{{bn_date_hour}}
Hour (01…24)
{{bn_date_day}}
Day (01…31)
{{bn_date_month}}
Month (01…12)
{{bn_date_year}}
Year (1900…)
{{bn_date_Yday}}
Day of the year (1…365)
{{bn_date_Wday}}
Day of the week. (1…7) 1 = Sunday, 2 = Monday… 7 = Saturday
{{bn_date_WdayTxt}}
Day of the week, in text. (monday, tuesday.. or monday, tuesday…)
{{bn_date_Period}}
Time of day. Useful for personalizing the reception!
1 = morning
2 = afternoon
3 = evening
4 = night
Example:
{{bn_date_TodayYMD}}
Displays the date in “computer” (database) format: 2018/04/28
{{bn_date_TodayYMDT}}
Displays the date in “computer” (database) format + time: 2018/04/28 11:18
{{bn_date_TodayMDY}}
Displays the date in US format: 04/28/2018
{{bn_date_TodayMDY}}
Displays the date in US format without the year: 04/28
{{bn_date_TodayMDYT}}
Displays the date in US format + time: 04/28/2018 11:18
{{bn_date_TodayMDYT}}
Displays the date in US format + time without the year: 04/28 11:18
{{bn_date_TodayMDYTXT}}
Displays the date in US text format: Friday May 4 2018
{{bn_date_TodayMDTXT}}
Displays the date in US text format without the year: Friday May 4
{{bn_date_TodayDMY}}
Displays the date in EU format: 28/04/2018
{{bn_date_TodayDM}}
Displays the date in EU format without the year : 28/04
{{bn_date_TodayDMYT}}
Displays the date in EU format: 28/04/2018 11:18
{{bn_date_TodayDMT}}
Displays the date in EU format without the year : 28/04 11:18
{{bn_date_TodayDMYTXT}}
Displays the date in EU text format: Friday, May 4, 2018
{{bn_date_TodayDMTXT}}
Displays the date in EU text format without the year: Friday May 4th
{{bn_date_timestamp}}
Gives the current timestamp, i.e. the number of seconds elapsed since January 1, 1970.
It is useful to measure the time spent between 2 events.
We take into account the user’s TimeZone. Concretely, at the same time, a chatbot can now display “Bonjour” to a French person and “Bonne nuit” to a Japanese person by using the magic variable {{bn_date_Period}} .
The dates can also be manipulated with options!
_-3_min
_+60_sec
_+1_hour
_-2_day
7 week
etc…
Examples:
{{bn_date_TodayDMY_+2_week}}
Will return the date that it will be exactly in 2 weeks.
This works on all previous functions, such as :
{{bn_date_TodayDMY_+25_day}}
Which will return the date to + 25 days.
!! IMPORTANT!!!
It is highly recommended to use the local (country) timezone of the Chatbot instead of the user’s timezone by adding _local before the period if your schedule should not change depending on the user’s location, for example for a physical store.
Examples:
{{bn_date_hour}} -> User time (Tokyo as Japanese)
{{bn_date_local_hour}} -> Time in the bot’s parameterized area (Paris for example)