内置日期和时间方法#
处理日期和时间的方法。
Python支持
你可以在代码节点中使用Python。但在表达式中不可用。
| 方法 | 描述 | 是否在代码节点中可用? |
|---|---|---|
$now |
A Luxon object containing the current timestamp. Equivalent to DateTime.now(). |
|
$today |
A Luxon object containing the current timestamp, rounded down to the day. Equivalent to DateTime.now().set({ hour: 0, minute: 0, second: 0, millisecond: 0 }). |
| 方法 | 描述 |
|---|---|
_now |
A Luxon object containing the current timestamp. Equivalent to DateTime.now(). |
_today |
A Luxon object containing the current timestamp, rounded down to the day. Equivalent to DateTime.now().set({ hour: 0, minute: 0, second: 0, millisecond: 0 }). |
n8n在节点之间以字符串形式传递日期,因此您需要解析它们。Luxon可以帮助您完成此操作。更多信息请参考Date and time with Luxon。
n8n提供内置的便捷函数来支持表达式中的日期数据转换。更多信息请参考Data transformation functions | Dates。