The functions in this group help you work with schedules: check business hours and find the nearest event dates. They all use the account time zone automatically.

Where it helps:

  • tell the subscriber whether support is online right now;
  • offer the nearest webinar that takes place on Thursdays;
  • remind about a payment charged on the 10th;
  • congratulate the subscriber on their birthday.

Functions

FunctionDescriptionExample
time_interval(start, end)Checks whether the current time is within the interval, in the account time zone. Accepts time as HH:MM or full dates. Works across midnight, for example time_interval("19:00", "07:00"). Handy for business hours.time_interval("10:00", "19:00") → True if it's now between 10:00 and 19:00
weekday_date(day, include_today)Returns the date of the next given day of the week: 1 is Monday, 7 is Sunday. Today isn't counted; to include it, pass True as the second argument. The result format is YYYY-MM-DD.If today is Friday, April 3, 2026:
weekday_date(1) → "2026-04-06"
weekday_date(5) → "2026-04-10"
weekday_date(5, True) → "2026-04-03"
month_date(day, include_today)Returns the next date with the given day of the month (1 to 31). If the month has no such day, returns the last day of the month. Today is counted only if you pass True as the second argument.If today is April 3, 2026:
month_date(10) → "2026-04-10"
month_date(3) → "2026-05-03"
month_date(31) → "2026-04-30"
birthdate(date)Returns the date of the next birthday, including today. For February 29 in a non-leap year, returns February 28. Uses the account time zone; the result format is YYYY-MM-DD.If today is April 3, 2026:
birthdate("1994-04-28") → "2026-04-28"
birthdate("1994-01-10") → "2027-01-10"

Example: business hours

Check that it’s a weekday between 10:00 and 19:00 and pick a reply.

client.is_work_time = time_interval("10:00", "19:00") and weekday() <= 5
client.answer_text = if(client.is_work_time, "An operator will reply within 15 minutes", "We'll reply tomorrow from 10:00")

weekday() <= 5 means today is Monday to Friday. The interval can cross midnight: time_interval("19:00", "07:00") returns True at night.

Example: the nearest Thursday webinar

client.webinar_date = weekday_date(4, True)
client.webinar_text = "See you on " + format_date(client.webinar_date, "%d.%m.%Y") + " at 7 pm"

If today is Friday, April 3, 2026, webinar_text gets See you on 09.04.2026 at 7 pm. If today is Thursday, True makes the function return today’s date.

Example: a payment reminder on the 10th

client.pay_date = month_date(10, True)
client.pay_text = "Next charge: " + format_date(client.pay_date, "%d.%m.%Y")

If the month has no such day (for example, the 31st), the function returns the last day of the month.

Example: birthday greeting

client.next_birthday = birthdate(client.birth_date)
client.birthday_text = "Your birthday is on " + format_date(client.next_birthday, "%d.%m.%Y") + ". A gift is waiting for you!"

For February 29 in a non-leap year, the function returns February 28.

Other date operations are described in Formula: Dates and Time.


If you did not find the answer to your question, feel free to contact us in the chat inside your dashboard, message us on Telegram at @BotHelpSupportBot, or email us at hello@bothelp.io.

Enjoy the full functionality of the BotHelp platform for creating broadcasts, automated funnels, and chatbots — free for 14 days.

Get 14 Days Free

Sign up for BotHelp

Get 14 days of full access for free — enough to build your first bot and test it on real subscribers.

Create account

Была ли статья полезна?

Our channelsTelegramMAX
Спасибо за обратную связь!