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 anotherfunctionconvertDateString(inputDateString) {// Import required Java classesvar SimpleDateFormat =Java.type('java.text.SimpleDateFormat');var Date =Java.type('java.util.Date');// Define input and output date formatsvar inputFormat =newSimpleDateFormat('dd-MM-yyyy');var outputFormat =newSimpleDateFormat('yyyy-MM-dd');try {// Parse the input date string using the input formatvar date =inputFormat.parse(inputDateString);// Format the parsed date using the output formatvar outputDateString =outputFormat.format(date);return outputDateString; } catch (e) {// Handle any parsing or formatting errorsprint('Error occurred during date conversion: '+ e);returnnull; // Return null in case of error }}// Call the conversion function with the input date stringvar outputDateString =convertDateString(inputDateString);// Output the result (formatted date string) to the calleroutputDateString;