Skip to main content

What is the best practise approach to manipulating dates? 

Given

/now =  ${time:now()}

 

I would like to modify “/now” to be -1/+1 Days and/or hours from the current timestamp. 

 

the only examples i could find of this are to first convert the date into milliseconds then followed by adding or subtracting the required number of Milliseconds to achieve the desired result  (Looking for a better way to achieve this)

 

hi @Bendjlee 

I suggest looking at creating custom function using Java. You can provide parameter like value ( +/- number of hours/days/months/year) and another parameter that takes the value like HOUR/DAY/MONTH/YEAR

More help about custom function here:https://streamsets.com/blog/create-custom-expression-language-function-streamsets-data-collector/

 


Reply