How to pass date in service

My service having start date and end date,

End date - Today’s date
Start date - Today’s date - 1 year

i need to pass this to service without getting from manually(ie. i want to calculate in a code itself),

Plz help

What format would you like the date in?



like this i need to pass the dates

import java.util.Calendar
import java.text.SimpleDateFormat

val today = Calendar.getInstance
val dateFormat = new SimpleDateFormat(“yyyy-MM-dd”)

today.add(Calendar.YEAR, -1)



Beware that SimpleDateFormat is not threadsafe. So you might want to store in a ThreadLocal, or use JDK8’s DateTime or ThreeTenBP.

Hi Stephane,

Could he not create the values in a before hook and pass these immutable values to the test scenario?

Absolutely. :slight_smile: