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?

Hi

…?start_date=2013-12-15&end_date=2014-12-15&…

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”)

println(dateFormat.format(today.getTime))
today.add(Calendar.YEAR, -1)
println(dateFormat.format(today.getTime))

2014-12-15

2013-12-15

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: