DateTime#
DateTime.day#
Description: The day of the month (1-31)
Syntax: DateTime.day
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.diffTo()#
Description: Returns the difference between two DateTimes, in the given unit(s)
Syntax: DateTime.diffTo(otherDateTime, unit)
Returns: Number
Source: Custom n8n functionality
Parameters:
otherDateTime(String|DateTime) - The moment to subtract the base DateTime from. Can be an ISO date string or a Luxon DateTime.unit(String|Array) - optional - The unit, or array of units, to return the result in. Possible values: years,months,weeks,days,hours,minutes,seconds,milliseconds.
Examples:
1 2 | |
1 2 3 | |
1 | |
DateTime.diffToNow()#
Description: Returns the difference between the current moment and the DateTime, in the given unit(s). For a textual representation, use toRelative() instead.
Syntax: DateTime.diffToNow(unit)
Returns: Number
Source: Custom n8n functionality
Parameters:
unit(String|Array) - optional - The unit, or array of units, to return the result in. Possible values: years,months,weeks,days,hours,minutes,seconds,milliseconds.
Examples:
1 2 | |
1 2 | |
1 | |
DateTime.endOf()#
Description: Rounds the DateTime up to the end of one of its units, e.g. the end of the month
Syntax: DateTime.endOf(unit, opts)
Returns: DateTime
Type: Luxon
Parameters:
unit(String) - The unit to round to the end of. Can beyear,quarter,month,week,day,hour,minute,second, ormillisecond.opts(Object) - optional - Object with options that affect the output. Possible properties:useLocaleWeeks(boolean): Whether to use the locale when calculating the start of the week. Defaults to false.
Examples:
1 2 | |
DateTime.equals()#
Description: Returns true if the two DateTimes represent exactly the same moment and are in the same time zone. For a less strict comparison, use hasSame().
Syntax: DateTime.equals(other)
Returns: Boolean
Type: Luxon
Parameters:
other(DateTime) - The other DateTime to compare
Examples:
1 2 3 | |
DateTime.extract()#
Description: Extracts a part of the date or time, e.g. the month, as a number. To extract textual names instead, see format().
Syntax: DateTime.extract(unit?)
Returns: Number
Source: Custom n8n functionality
Parameters:
unit(String) - optional - The part of the date or time to return. One of:year,month,week,day,hour,minute,second
Examples:
1 2 | |
1 2 | |
DateTime.format()#
Description: Converts the DateTime to a string, using the format specified. Formatting guide. For common formats, toLocaleString() may be easier.
Syntax: DateTime.format(fmt)
Returns: String
Source: Custom n8n functionality
Parameters:
fmt(String) - The format of the string to return
Examples:
1 2 | |
1 2 3 4 | |
DateTime.hasSame()#
Description: Returns true if the two DateTimes are the same, down to the unit specified. Time zones are ignored (only local times are compared), so use toUTC() first if needed.
Syntax: DateTime.hasSame(otherDateTime, unit)
Returns: Boolean
Type: Luxon
Parameters:
otherDateTime(DateTime) - The other DateTime to compareunit(String) - The unit of time to check sameness down to. One ofyear,quarter,month,week,day,hour,minute,second, ormillisecond.
Examples:
1 2 3 | |
1 2 3 | |
DateTime.hour#
Description: The hour of the day (0-23)
Syntax: DateTime.hour
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.isBetween()#
Description: Returns true if the DateTime lies between the two moments specified
Syntax: DateTime.isBetween(date1, date2)
Returns: Boolean
Source: Custom n8n functionality
Parameters:
date1(String|DateTime) - The moment that the base DateTime must be after. Can be an ISO date string or a Luxon DateTime.date2(String|DateTime) - The moment that the base DateTime must be before. Can be an ISO date string or a Luxon DateTime.
Examples:
1 2 | |
1 2 | |
DateTime.isInDST#
Description: Whether the DateTime is in daylight saving time
Syntax: DateTime.isInDST
Returns: Boolean
Type: Luxon
DateTime.locale#
Description: The locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime.
Syntax: DateTime.locale
Returns: String
Type: Luxon
Examples:
1 | |
DateTime.millisecond#
Description: The millisecond of the second (0-999)
Syntax: DateTime.millisecond
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.minus()#
Description: Subtracts a given period of time from the DateTime
Syntax: DateTime.minus(n, unit?)
Returns: DateTime
Source: Custom n8n functionality
Parameters:
n(Number|Object) - The number of units to subtract. Or use a Luxon Duration object to subtract multiple units at once.unit(String) - optional - The units of the number. One of:years,months,weeks,days,hours,minutes,seconds,milliseconds
Examples:
1 2 | |
1 2 | |
DateTime.minute#
Description: The minute of the hour (0-59)
Syntax: DateTime.minute
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.month#
Description: The month (1-12)
Syntax: DateTime.month
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.monthLong#
Description: The textual long month name, e.g. 'October'. Defaults to the system's locale if no locale has been specified.
Syntax: DateTime.monthLong
Returns: String
Type: Luxon
Examples:
1 2 | |
1 2 | |
DateTime.monthShort#
Description: The textual abbreviated month name, e.g. 'Oct'. Defaults to the system's locale if no locale has been specified.
Syntax: DateTime.monthShort
Returns: String
Type: Luxon
Examples:
1 2 | |
1 2 | |
DateTime.plus()#
Description: Adds a given period of time to the DateTime
Syntax: DateTime.plus(n, unit?)
Returns: DateTime
Source: Custom n8n functionality
Parameters:
n(Number|Object) - The number of units to add. Or use a Luxon Duration object to add multiple units at once.unit(String) - optional - The units of the number. One of:years,months,weeks,days,hours,minutes,seconds,milliseconds
Examples:
1 2 | |
1 2 | |
DateTime.quarter#
Description: The quarter of the year (1-4)
Syntax: DateTime.quarter
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.second#
Description: The second of the minute (0-59)
Syntax: DateTime.second
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.set()#
Description: Assigns new values to specified units of the DateTime. To round a DateTime, see also startOf() and endOf().
Syntax: DateTime.set(values)
Returns: DateTime
Type: Luxon
Parameters:
values(Object) - An object containing the units to set and corresponding values to assign. Possible keys areyear,month,day,hour,minute,secondandmillsecond.
Examples:
1 2 | |
DateTime.setLocale()#
Description: Sets the locale, which determines the language and formatting for the DateTime. Useful when generating a textual representation of the DateTime, e.g. with format() or toLocaleString().
Syntax: DateTime.setLocale(locale)
Returns: DateTime
Type: Luxon
Parameters:
locale(String) - The locale to assign, e.g. ‘en-GB’ for British English or ‘pt-BR’ for Brazilian Portuguese. List (unofficial)
Examples:
1 | |
1 | |
DateTime.setZone()#
Description: Converts the DateTime to the given time zone. The DateTime still represents the same moment unless specified in the options. See also toLocal() and toUTC().
Syntax: DateTime.setZone(zone, opts)
Returns: DateTime
Type: Luxon
Parameters:
zone(String) - optional - A zone identifier, either in the format ‘America/New_York’, 'UTC+3', or the strings 'local' or 'utc'opts(Object) - optional - Options that affect the output. Possible properties:keepCalendarTime(boolean): Whether to keep the time the same and only change the offset. Defaults to false.
Examples:
1 2 | |
1 2 | |
DateTime.startOf()#
Description: Rounds the DateTime down to the beginning of one of its units, e.g. the start of the month
Syntax: DateTime.startOf(unit, opts)
Returns: DateTime
Type: Luxon
Parameters:
unit(String) - The unit to round to the beginning of. One ofyear,quarter,month,week,day,hour,minute,second, ormillisecond.opts(Object) - optional - Object with options that affect the output. Possible properties:useLocaleWeeks(boolean): Whether to use the locale when calculating the start of the week. Defaults to false.
Examples:
1 2 | |
DateTime.toISO()#
Description: Returns an ISO 8601-compliant string representation of the DateTime
Syntax: DateTime.toISO(opts)
Returns: String
Type: Luxon
Parameters:
opts(Object) - optional - Configuration options. See Luxon docs for more info.
Examples:
1 | |
DateTime.toLocal()#
Description: Converts a DateTime to the workflow’s local time zone. The DateTime still represents the same moment unless specified in the parameters. The workflow’s time zone can be set in the workflow settings.
Syntax: DateTime.toLocal()
Returns: DateTime
Type: Luxon
Examples:
1 2 | |
DateTime.toLocaleString()#
Description: Returns a localised string representing the DateTime, i.e. in the language and format corresponding to its locale. Defaults to the system's locale if none specified.
Syntax: DateTime.toLocaleString(formatOpts)
Returns: String
Type: Luxon
Parameters:
formatOpts(Object) - optional - Configuration options for the rendering. See Intl.DateTimeFormat for a full list. Defaults to rendering a short date.
Examples:
1 2 3 | |
1 | |
1 2 3 4 5 | |
1 2 3 4 5 | |
1 2 3 4 5 | |
1 2 3 | |
DateTime.toMillis()#
Description: Returns a Unix timestamp in milliseconds (the number elapsed since 1st Jan 1970)
Syntax: DateTime.toMillis()
Returns: Number
Type: Luxon
Examples:
1 | |
DateTime.toRelative()#
Description: Returns a textual representation of the time relative to now, e.g. ‘in two days’. Rounds down by default.
Syntax: DateTime.toRelative(options)
Returns: String
Type: Luxon
Parameters:
options(Object) - optional - Options that affect the output. Possible properties:unit= the unit to default to (years,months,days, etc.).locale= the language and formatting to use (e.g.de,fr)
Examples:
1 | |
1 | |
1 | |
DateTime.toSeconds()#
Description: Returns a Unix timestamp in seconds (the number elapsed since 1st Jan 1970)
Syntax: DateTime.toSeconds()
Returns: Number
Type: Luxon
Examples:
1 | |
DateTime.toString()#
Description: Returns a string representation of the DateTime. Similar to toISO(). For more formatting options, see format() or toLocaleString().
Syntax: DateTime.toString()
Returns: string
Type: Luxon
Examples:
1 | |
DateTime.toUTC()#
Description: Converts a DateTime to the UTC time zone. The DateTime still represents the same moment unless specified in the parameters. Use setZone() to convert to other zones.
Syntax: DateTime.toUTC(offset, opts)
Returns: DateTime
Type: Luxon
Parameters:
offset(Number) - optional - An offset from UTC in minutesopts(Object) - optional - Object with options that affect the output. Possible properties:keepCalendarTime(boolean): Whether to keep the time the same and only change the offset. Defaults to false.
Examples:
1 2 | |
DateTime.weekday#
Description: The day of the week. 1 is Monday and 7 is Sunday.
Syntax: DateTime.weekday
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.weekdayLong#
Description: The textual long weekday name, e.g. 'Wednesday'. Defaults to the system's locale if no locale has been specified.
Syntax: DateTime.weekdayLong
Returns: String
Type: Luxon
Examples:
1 2 | |
1 2 | |
DateTime.weekdayShort#
Description: The textual abbreviated weekday name, e.g. 'Wed'. Defaults to the system's locale if no locale has been specified.
Syntax: DateTime.weekdayShort
Returns: String
Type: Luxon
Examples:
1 2 | |
1 2 | |
DateTime.weekNumber#
Description: The week number of the year (1-52ish)
Syntax: DateTime.weekNumber
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.year#
Description: The year
Syntax: DateTime.year
Returns: Number
Type: Luxon
Examples:
1 2 | |
DateTime.zone#
Description: The time zone associated with the DateTime
Syntax: DateTime.zone
Returns: Object
Type: Luxon
Examples:
1 | |