All templates
Date & TimeIntermediate
Get First Working Day of the Next Month
Robomotion•Updated 9 months ago

Overview
Computes the first business day of next month, skipping weekends. Useful for scheduling invoices, reports, or reminders that must fire on a working day.
Get First Working Day of the Next Month
Performing calculations with dates is an essential part of many business processes, as most reports and invoices contain time-related data. Robomotion enables you to add various time units to date values and get precise results for further processing.
What Get First Working Day of the Next Month can do
Robomotion.DateTime.Now(optLayout: 'RFC3339',optTimezoneOffset: 'Local') →msg.now.Core.Programming.Functionbuildsmsg.first_day_of_next_monthasnew Date(year, month+1, 1, 0, 0, 1).toISOString().Robomotion.DateTime.Splitonmsg.first_day_of_next_month→msg.first_parts(exposesweekday).- Branch (
Core.Programming.Function,outputs: 2) — port 0 whenmsg.day_of_weekstarts withS(Saturday/Sunday), port 1 otherwise. - Weekend branch:
Core.Dialog.MessageBoxtitledWorking DayshowsFirst working day of next month is Monday. - Weekday branch: Function composes
msg.dialog_text;Core.Dialog.MessageBoxtitledWorking day infoshows it.
Behind the scenes
- The
S-prefix test catches Saturday and Sunday in a single comparison (msg.day_of_week.charAt(0).toUpperCase() === 'S') and avoids locale-specific weekday strings when English locale is assumed. - December-to-January rollover is handled implicitly by
new Date(year, month+1, 1)— JavaScript'sDateconstructor normalises month overflow, so no manual year bump is needed. - The weekend branch does not compute Monday's actual date — it just displays the word "Monday". If the real date is required, add a loop that increments the day until
weekday === 'Monday'before the message box. - The
0, 0, 1seconds argument shifts the timestamp one second past midnight, which avoids edge cases where a subsequentSplitrounds down into the previous day under some timezone conversions.
More date & time templates
See all 6 →- Convert Datetime to TextConverts a datetime value into a formatted text string using the Robomotion DateTime package. Demonstrates standard and custom output layouts for logging, filenames, and reports.
- Convert Text to DatetimeParses a text string like "2025-05-01 09:30:00" into a true datetime value the flow can work with. Shows how to declare an input layout so downstream nodes can format or compare the date.
- Days of Your LifeCalculates how many days you have been alive by subtracting your birthday from today. Uses DateTime Now, Subtract, and a Function node to produce a clean day count.
- Get Current TimeReads the local date and time and formats it as a long time string (HH:mm:ss). Displays the result in an information dialog so you can verify the system clock at a glance.
- Get Previous Working DateWalks backwards from today to find the previous working day, handling weekends through conditional logic. A building block for backdated reports or audits.