Skip to main content

Date To String

This node formats a Date object into a readable text string.

The Date To String node converts timestamps into formats like "YYYY-MM-DD".

The Date To String node takes a Date object (or date string) and formats it according to a template string. It supports placeholders for year, month, day, hours, minutes, and seconds.

Inputs

General

DataDescription
DateThe input date to format. Accepts Date objects or ISO date strings.
FormatThe template string. Default: {year}-{month}-{date}.

Outputs

Value

DataDescription
Date StringThe formatted text result.

Signals

SignalDescription
Date ChangedTriggered when the output updates.
Invalid DateTriggered if the input cannot be parsed as a valid date.

Usage

Formatting Options

Use these placeholders in the Format string:

  • {year}: 4-digit year (2023)
  • {yearShort}: 2-digit year (23)
  • {month}: 2-digit month (01-12)
  • {monthShort}: Short name (Jan, Feb)
  • {date}: 2-digit day (01-31)
  • {hours}: 2-digit hour (00-23)
  • {minutes}: 2-digit minute (00-59)
  • {seconds}: 2-digit second (00-59)

Example

Format: {date} {monthShort}, {year} at {hours}:{minutes} Result: "15 Oct, 2023 at 14:30"

Detailed Behavior

  • Locale: Uses en-US for month names currently.
  • Parsing: Attempts to parse strings using new Date().

Troubleshooting

  • Invalid Date: If the input string is malformed, the output will be empty and the Invalid Date signal will fire.