1001fx - NoCode functions icon

1001fx - NoCode functions

1001fx is a set of functions for any automation platform. Our functions are simple, very well tested, scalable and offer features that most automation platforms do not offer.

Actions74

datetime → Format Date and Time

AI-generated

Overview

The Format Date and Time operation in the "datetime" resource of this n8n node allows you to reformat a given date string into a desired output format. This is useful when working with dates from various sources that may use different formats, and you need to standardize or convert them for further processing, display, or integration with other systems.

Common scenarios:

  • Converting user-inputted dates into ISO 8601 format for database storage.
  • Formatting dates for reports or emails.
  • Parsing ambiguous date strings by specifying possible input formats.

Practical example:
If you receive a date as "31.12.2023" and want it in "YYYY-MM-DD" format, this node can handle the conversion, even if the input format varies.


Properties

Name Meaning
Date The date to format. If "Formats to test" is not provided, your date needs to be in one of the following formats: DD.MM.YYYY, DD.MM.YY, DD.MM.YYYY HH:mm, DD.MM.YY HH:mm, MM-DD-YYYY, MM-DD-YYYY HH:mm, MM-DD-YY, MM-DD-YY HH:mm.
Output Format The desired output format for the date (e.g., YYYY-MM-DD, MM/DD/YYYY).
Formats to test Input Mode How to provide the list of possible input formats. Options: Expression (provide as JSON array), Manual (enter formats manually).
Formats to test The formats the date can be in. If using "Expression", provide as a JSON array; if using "Manual", enter multiple values.

Output

  • json: The output will contain the formatted date according to the specified "Output Format".
    • If successful, the output will typically include a field with the reformatted date (the exact key depends on the API response).
    • If an error occurs, the output will include an error field with details about the issue.

Example output (success):

{
  "formattedDate": "2023-12-31"
}

Example output (error):

{
  "error": "Invalid date format"
}

Dependencies

  • External Service: Requires access to the 1001fx API.
  • API Key: You must configure the 1001fxApi credential in n8n.
  • Environment: No special environment variables required beyond n8n's standard configuration.

Troubleshooting

Common issues:

  • Invalid date format: If the input date does not match any of the expected formats, the node will return an error. Ensure your "Date" property matches one of the specified formats or provide the correct formats in "Formats to test".
  • Missing API credentials: If the 1001fxApi credential is not set up, the node will fail to authenticate.
  • Incorrect output format: If the "Output Format" is invalid or unsupported, the API may return an error.

Error messages:

  • "Invalid date format": The input date could not be parsed. Check your input and the "Formats to test".
  • "Missing required parameter": One of the required properties was not provided.
  • "Authentication failed": The API key is missing or incorrect.

Links and References

Discussion