Skip to content
Get on GitHub Autodesk App Store - coming soon

DateTime

18 nodes. Types ending in [] are lists. An input with a default is optional.

Nodes

DateTime.Add

Adds an amount of time to a date/time in a chosen unit — seconds, minutes, hours, days, weeks, months or years (negative values go back). Days, hours and the smaller units take fractions (0.5 days = 12 hours); months and years are calendar steps that clamp to the end of a shorter month (31 January + 1 month = 28 February) and take whole numbers. For working days use DateTime.AddWorkdays.

Inputs

Input Type Default What it does
dateTime required datetime — The date/time to offset.
amount required number — How much to add, in the chosen unit (negative values go back).
unit string "days" "seconds", "minutes", "hours", "days" (default), "weeks", "months" or "years" (any case).

Outputs

Output Type What it gives
dateTime datetime The offset date/time.

Tags: offset shift schedule date later earlier time plus minus move delay duration AddDays AddHours AddMinutes AddMonths AddYears month year hour minute day week

DateTime.AddWorkdays

Moves a date/time by a number of working days, skipping the weekend (Saturday and Sunday, or Friday and Saturday): Friday + 1 is Monday, Monday - 1 is Friday, Saturday + 1 is Monday. The time of day is kept. Public holidays are not known: move the result on by hand when one falls in between.

Inputs

Input Type Default What it does
dateTime required datetime — The date/time to move.
days required integer — Working days to add (whole number, negative goes back).
weekend string "Saturday and Sunday" Which two days are not working days: "Saturday and Sunday" (default) or "Friday and Saturday".

Outputs

Output Type What it gives
dateTime datetime The date/time that many working days later (or earlier).

Tags: workday working day business day weekday skip weekend schedule offset shift later earlier 4d

DateTime.ByDate

Creates a date from year, month and day numbers.

Inputs

Input Type Default What it does
year required integer — Year, e.g. 2026.
month required integer — Month, 1-12.
day required integer — Day of month, 1-31.

Outputs

Output Type What it gives
dateTime datetime The date at midnight.

Tags: construct ymd calendar date

DateTime.Compare

Compares two date/times: -1 when the first is earlier, 0 when equal, 1 when it is later.

Inputs

Input Type Default What it does
a required datetime — The first date/time.
b required datetime — The second date/time.

Outputs

Output Type What it gives
result integer -1 when a is earlier than b, 0 when they are equal, 1 when a is later than b.

Tags: earlier later before after equal order sort

DateTime.Components

Splits a date/time into year, month, day, hour, minute, second, English weekday name, day of year, ISO week, ISO year and quarter.

Inputs

Input Type Default What it does
dateTime required datetime — The date/time to split.

Outputs

Output Type
year integer
month integer
day integer
hour integer
minute integer
second integer
weekday string
dayOfYear integer
isoWeek integer
isoYear integer
quarter integer

Returns: Dictionary with "year", "month", "day", "hour", "minute", "second", "weekday", "dayOfYear", "isoWeek", "isoYear" and "quarter".

Tags: deconstruct parts year month weekday week number iso week quarter

DateTime.DaysBetween

Returns the signed number of days between two date/times (end minus start), with the time of day as a fraction. For how old something is, wire the date into start and DateTime.Now into end; a date in the future then gives a negative number. DateTime.Difference gives the same in hours, weeks, months and so on.

Inputs

Input Type Default What it does
start required datetime — The starting date/time.
end required datetime — The ending date/time.

Outputs

Output Type What it gives
days number The signed day difference.

Tags: difference duration span elapsed age old overdue since AgeInDays

DateTime.Difference

How far apart two date/times are in a chosen unit — seconds, minutes, hours, days, weeks, months or years (end minus start, so a negative number means the end is earlier). Months and years count calendar months (10 January to 10 March is exactly 2) with the rest as a fraction; the other units are elapsed time with fractions. For how old something is, wire DateTime.Now into end.

Inputs

Input Type Default What it does
start required datetime — The starting date/time.
end required datetime — The ending date/time.
unit string "days" "seconds", "minutes", "hours", "days" (default), "weeks", "months" or "years" (any case).

Outputs

Output Type What it gives
difference number The signed difference in that unit.

Tags: difference between duration span elapsed age old since overdue interval how long DaysBetween AgeInDays

DateTime.EndOf

Returns the last millisecond of the day, week, month, quarter or year containing a date/time (start of the next period minus 1 ms).

Inputs

Input Type Default What it does
dateTime required datetime — The date/time inside the period.
unit string "week" "day", "week", "month", "quarter" or "year" (any case).
firstDayOfWeek string "Monday" "Monday" or "Sunday" (any case); only used for "week".

Outputs

Output Type What it gives
dateTime datetime The start of the next period minus one millisecond.

Tags: ceiling period last day finish deadline week month quarter year

DateTime.Format

Formats a date/time as text using a .NET format string (invariant culture): yyyy-MM-dd gives 2026-07-10, dd/MM/yyyy gives 10/07/2026, HH:mm gives 14:30, MMMM gives the English month name.

Inputs

Input Type Default What it does
dateTime required datetime — The date/time to format.
format string "yyyy-MM-dd HH:mm:ss" .NET date format string.

Outputs

Output Type What it gives
text string The formatted text.

Tags: tostring date time pattern

DateTime.FromExcelSerial

Converts an Excel date serial number (days since 1899-12-30, the time of day as the fraction; 46000.5 is noon) to a date/time — what Excel.ReadFromFile and Table.FromExcelFile hand over for a date cell. Wire the column in and the whole column converts. Use dateSystem 1904 for workbooks that use the 1904 date system. Dates before March 1900 come out one day later than Excel shows them, because Excel counts a 29 February 1900 that never existed.

Inputs

Input Type Default What it does
serial required number — The Excel serial number (days, with the time of day as a fraction).
dateSystem string "1900" "1900" (default, Excel for Windows and current Excel for Mac) or "1904" (workbooks from old Excel for Mac).

Outputs

Output Type What it gives
dateTime datetime The date/time (kind not specified).

Tags: excel xlsx serial date spreadsheet oadate convert import column

DateTime.FromUnixSeconds

Converts Unix seconds since 1970-01-01 UTC to a (UTC) date/time.

Inputs

Input Type Default What it does
seconds required number — Seconds since the Unix epoch (negative before 1970).

Outputs

Output Type What it gives
dateTime datetime The date/time, with kind UTC.

Tags: epoch timestamp posix unix seconds convert

DateTime.IsWeekend

True when a date falls on the weekend (Saturday and Sunday, or Friday and Saturday) — a mask for filtering a schedule down to working days.

Inputs

Input Type Default What it does
dateTime required datetime — The date/time to test.
weekend string "Saturday and Sunday" Which two days are the weekend: "Saturday and Sunday" (default) or "Friday and Saturday".

Outputs

Output Type What it gives
isWeekend boolean True on a weekend day.

Tags: weekday workday working day business day saturday sunday schedule filter

DateTime.Now

Returns the current local date and time (captured at execution). At the top level the value is kept until you run the node again; inside a node group every call asks the clock again, so for one timestamp shared by a whole report make it outside the group and pass it in through a Group Input.

No inputs.

Outputs

Output Type What it gives
dateTime datetime The current local date and time.

Tags: today current clock time timestamp

DateTime.Parse

Parses text as a date/time. ISO dates (2026-07-10, 2026-07-10 14:30) always work. Numeric dates with slashes, dots or dashes are ambiguous: 10/07/2026 is 7 October month first (the default) and 10 July with dayFirst on. When a date could be read either way and dayFirst is off, the node says which reading it took. An exact .NET format (dd/MM/yyyy, dd.MM.yyyy HH:mm) overrides both and refuses anything else.

Inputs

Input Type Default What it does
text required string — The text to parse.
format string "" Optional exact .NET date format string; when given, dayFirst is not used.
dayFirst boolean false True to read numeric dates such as 10/07/2026, 10.07.2026 or 10-07-2026 as day, month, year (10 July); false (default) reads them month first (7 October). ISO dates (2026-07-10) are never ambiguous.

Outputs

Output Type What it gives
dateTime datetime The parsed date/time.

Tags: fromstring convert date time dayfirst day first dd/mm/yyyy european ambiguous

DateTime.Range

Creates a list of dates from a start to an end (both included) with a step in days, weeks, months or years ("every month" lands on the same day of each month, clamped to the month's end); at most 100000 items.

Inputs

Input Type Default What it does
start required datetime — The first date.
end required datetime — The last date (included when the step lands on it).
step number 1 How many units between two items; must be greater than 0 (a whole number for months and years).
unit string "days" "days" (default), "weeks", "months" or "years" (any case).

Outputs

Output Type What it gives
dates datetime[] The dates, in order.

Tags: sequence series calendar schedule every days timeline monthly weekly yearly month week year

DateTime.StartOf

Returns midnight at the start of the day, week, month, quarter or year containing a date/time.

Inputs

Input Type Default What it does
dateTime required datetime — The date/time inside the period.
unit string "week" "day", "week", "month", "quarter" or "year" (any case).
firstDayOfWeek string "Monday" "Monday" or "Sunday" (any case); only used for "week".

Outputs

Output Type What it gives
dateTime datetime The first instant (00:00:00) of the period.

Tags: floor truncate period first day beginning week month quarter year

DateTime.Today

Returns today's local date at midnight (captured at execution). At the top level the value is kept until you run the node again; inside a node group every call asks the clock again, so for one date shared by a whole report make it outside the group and pass it in through a Group Input.

No inputs.

Outputs

Output Type What it gives
dateTime datetime The local date at 00:00:00.

Tags: current date now midnight day

DateTime.ToUnixSeconds

Converts a date/time to Unix seconds since 1970-01-01 UTC (a value without a time zone is taken as UTC).

Inputs

Input Type Default What it does
dateTime required datetime — The date/time to convert.

Outputs

Output Type What it gives
seconds number Seconds since the Unix epoch (negative before 1970).

Tags: epoch timestamp posix unix seconds convert