Actions8
Overview
This custom node provides various utility operations under a single "Custom" resource, including the ability to get the current date and time adjusted by a specified amount of time units and formatted according to a selected timezone and 12/24-hour preference. The "Current Date & Time" operation is useful for workflows that require dynamic timestamps, scheduling, or time-based calculations.
For example, you can use this node to:
- Retrieve the current date and time in a specific timezone (e.g., Asia/Kuala_Lumpur).
- Format the time in 12-hour (AM/PM) or 24-hour format.
- Calculate a new date/time by adding or subtracting days, hours, minutes, months, weeks, or years from the current time.
This is beneficial in automation scenarios such as sending scheduled notifications, logging events with localized timestamps, or calculating expiry dates dynamically.
Properties
| Name | Meaning |
|---|---|
| CJ Token | Your API token from sifuim.com required for authentication and usage tracking. |
| Timezone | Select the timezone for the date and time output. Options include Brunei, Cambodia, Indonesia (Jakarta, Jayapura, Makassar), Laos, London, Malaysia, Myanmar, New York, Philippines, Singapore, Sydney, Thailand, Tokyo, UTC, Vietnam. Default is Asia/Kuala_Lumpur. |
| Format 12 Jam | Boolean option to choose between 12-hour (AM/PM) format (true) or 24-hour format (false). |
| Calculator Type | Optional unit of time to add or subtract: Day, Hour, Minute, Month, Week, Year. Default is Minute. |
| Time Frame | Number of time units to add (positive) or subtract (negative) based on the selected Calculator Type. Default is 0 (no change). |
Output
The node outputs a JSON object representing the calculated current date and time adjusted by the specified parameters. The exact structure depends on the implementation of the getCurrentDateTime function but typically includes fields such as:
- The resulting date and time string formatted according to the chosen timezone and 12/24-hour format.
- Possibly separate fields for date and time components.
- Adjusted date/time after applying the addition or subtraction of time units.
Example output JSON (illustrative):
{
"dateTime": "2024-06-01 03:45 PM",
"timezone": "Asia/Kuala_Lumpur",
"calculatorType": "minute",
"timeFrame": 15
}
No binary data output is produced by this operation.
Dependencies
- Requires a valid API token ("CJ Token") from sifuim.com for authentication and credit deduction.
- Uses internal helper functions imported from
GenericFunctionsfor date/time calculation and API key validation. - No external environment variables are explicitly required beyond the API token input.
Troubleshooting
- Invalid or missing API token: The node requires a valid CJ Token. If omitted or invalid, the node will throw an error during execution. Ensure your token is correct and active.
- Unsupported timezone or format issues: Selecting an unsupported timezone value may cause unexpected results. Use one of the provided options.
- Incorrect time frame values: Providing non-numeric or extremely large positive/negative numbers for the time frame could lead to incorrect date calculations.
- API credit deduction failures: The node attempts to deduct credits after each operation. Failures here might not stop execution but could indicate issues with your account or token.
- Unhandled operation errors: If the operation name is misspelled or changed, the node will throw an error indicating the operation is not implemented.
To resolve errors, verify all input parameters, especially the API token and timezone, and ensure network connectivity to the API service.
Links and References
- sifuim.com – Source of the API token and related services.
- Moment.js Timezone Documentation – For understanding timezone handling (likely used internally).
- n8n Documentation on Creating Custom Nodes