Solved

Date Manipulation

  • 31 August 2022
  • 1 reply
  • 56 views

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)

 

icon

Best answer by saleempothiwala 5 September 2022, 12:23

View original

1 reply

Userlevel 3
Badge

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