Date Decrement Days ?

This wildcard allows you to generate a new date string by subtracting a specified number of days from today's date. The node takes an input integer, decrements it, and provides a new date.

For instance (today: 2024-01-24): {date.decrement.days.5} -> 2024-01-19

Ensure that the format of the resulting date conforms to the pattern YYYY-MM-DD if it is intended for use in another date-time node.

In Helmut4 version 4.7.x and earlier, the wildcard returned the pattern DD-MM-YYYY, which could not be directly used to update date metadata.

Convert Date Format from DD-MM-YYYY to YYYY-MM-DD

Code to convert date with javascript node

// Input date string (replace '{stream.variable.newDate}' with your actual date string)
var inputDateString = '{stream.variable.newDate}';

// Function to convert date string from one format to another
function convertDateString(inputDateString) {
    // Import required Java classes
    var SimpleDateFormat = Java.type('java.text.SimpleDateFormat');
    var Date = Java.type('java.util.Date');

    // Define input and output date formats
    var inputFormat = new SimpleDateFormat('dd-MM-yyyy');
    var outputFormat = new SimpleDateFormat('yyyy-MM-dd');

    try {
        // Parse the input date string using the input format
        var date = inputFormat.parse(inputDateString);

        // Format the parsed date using the output format
        var outputDateString = outputFormat.format(date);

        return outputDateString;
    } catch (e) {
        // Handle any parsing or formatting errors
        print('Error occurred during date conversion: ' + e);
        return null; // Return null in case of error
    }
}

// Call the conversion function with the input date string
var outputDateString = convertDateString(inputDateString);

// Output the result (formatted date string) to the caller
outputDateString;