0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

Date and Time → Switch Time Zone

AI-generated

Overview

The "Switch Time Zone" operation in the Date and Time resource allows users to convert a given date and time from one time zone to another. This is particularly useful when working with data or events that originate from different geographical locations, ensuring consistent and accurate time representation across systems.

Common scenarios include:

  • Converting timestamps from a user's local time zone to UTC for standardized storage.
  • Displaying event times in the viewer's local time zone on a global application.
  • Synchronizing schedules or logs coming from multiple time zones.

For example, converting "2023-01-01 12:00:00" from "America/New_York" to "Europe/Berlin" will adjust the time accordingly based on the time zone difference.

Properties

Name Meaning
Date/Time The date and time string to be converted. Example format: "2023-01-01 12:00:00".
From Time Zone The source time zone of the input date/time. Examples: "UTC", "America/New_York", "Europe/Berlin".
To Time Zone The target time zone to convert the date/time into. Examples: "UTC", "America/New_York", "Europe/Berlin".

Output

The node outputs a JSON object containing the converted date and time adjusted to the target time zone. The exact structure is not explicitly shown in the provided code, but typically it would include at least:

{
  "convertedDateTime": "string"
}

where "convertedDateTime" is the date/time string after conversion.

No binary data output is indicated for this operation.

Dependencies

  • Requires an API key credential to authenticate requests to the external service at https://prod.0codekit.com.
  • The node sends a POST request to the endpoint /dateandtime/switchtimezone with the parameters dateTime, fromTimeZone, and toTimeZone in the request body.
  • Proper configuration of the API key credential within n8n is necessary for successful execution.

Troubleshooting

  • Invalid Time Zone Error: If the provided time zone strings are invalid or unrecognized, the API may return an error. Ensure time zones follow standard IANA time zone database names (e.g., "America/New_York").
  • Incorrect Date Format: Providing a date/time string in an unsupported format might cause parsing errors. Use ISO-like formats such as "YYYY-MM-DD HH:mm:ss".
  • Authentication Failures: Missing or incorrect API key credentials will prevent the node from connecting to the service.
  • Network Issues: Connectivity problems to the external API endpoint can cause timeouts or failures.

To resolve these issues:

  • Validate time zone inputs against known standards.
  • Confirm date/time formatting matches expected patterns.
  • Verify API key credentials are correctly set up in n8n.
  • Check network connectivity and firewall settings.

Links and References

Discussion