Skip to content

DateTimeTask โ€‹

The DateTimeTask node generates the current date and time, with optional adjustments and formatting. It is typically used to compute dynamic timestamps for logging, scheduling, or data formatting within your automation workflow.


๐Ÿงฉ Node Type โ€‹

  • Category: Task
  • TaskType: DateTimeTask
  • Icon: mdi mdi-calendar-clock
  • Outputs:
    • DateTimeObject: The calculated DateTime value.
    • StringFormattedDate: The string representation of the date (if formatting is specified).

โš™๏ธ Inputs โ€‹

LabelTypeDescriptionRequiredVisible When
Adjust Now DatepicklistThe unit to adjust the current date/time by.NoAlways
Number to Adjust bytextThe number of units to adjust the current date by.NoWhen Adjust Now Date is specified
String Formatted DatetextA .NET format string to convert the date to a formatted string.NoAlways
Output Variable NametextThe variable name to store the formatted date string.NoAlways

๐Ÿ”ฝ Options for "Adjust Now Date" โ€‹

OptionDescription
Add YearsAdds the specified number of years
AddMonthsAdds the specified number of months
Add DaysAdds the specified number of days
Add HoursAdds the specified number of hours
Add MinutesAdds the specified number of minutes
Add SecondsAdds the specified number of seconds
Add MillisecondsAdds the specified number of milliseconds

๐Ÿงช Example Configuration โ€‹

  • Adjust Now Date: Add Days
  • Number to Adjust by: 2
  • String Formatted Date: yyyy-MM-dd
  • Output Variable Name: myDate

Resulting output:

  • DateTimeObject: The current date + 2 days (as a DateTime object)
  • StringFormattedDate: A string like 2025-06-20

โœ… Output โ€‹

KeyTypeDescription
DateTimeObjectDateTimeThe calculated DateTime, with adjustment applied if needed.
StringFormattedDatestringThe string representation of the date, if format is provided.

โš ๏ธ Notes โ€‹

  • If no adjustment is provided, the task uses the current system time (DateTime.Now).
  • The .NET date format string must be valid or the task will fail.
  • Reference: .NET custom date format strings

๐Ÿšซ Errors โ€‹

This node may return Fail in the following cases:

  • No user inputs provided.
  • The date format string is invalid.
  • An unhandled exception occurs during execution.

๐Ÿงฑ Implementation Notes โ€‹

  • Namespace: MinuteView_Automations.Tasks.Actions.Utilities
  • Class: DateTimeTask : BaseTask
  • Uses DateTime.Now as the starting point.
  • Adjusts the date based on selected unit and input value.
  • Supports string formatting using standard .NET format codes.

Tentech 2024