I need to get a date by subtracting a number from current date in MM/dd/yyyy format
I got the current date by using new Date().format("MM/dd/yyyy")
Please help me with a function that subtracts 1,2 to the above date and produces a date in MM/dd/yyyy format
I have tried
def today = new Date().format("MM/dd/yyyy")
def yesterday = today -1
println today
println yesterday
which gives me
01/11/2012
0/11/2012
You are subtracting from a String
try: