Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 20990

How to Subtract days or years from new java.text.SimpleDateFormat

$
0
0

I could swear this worked at one time where I use the below:

${=(new java.text.SimpleDateFormat("yyyy-MM-dd")).format( new Date() )}

To Subtract or Add I would add enclose the -# or +# like so:

 

${=${=(new java.text.SimpleDateFormat("yyyy-MM-dd")).format( new Date() )}-1

The result of the -1 is showing up as 1982

 

QUESTIONS: 1. Why is it taking away the -MM-dd part? 2. Why is it subtracting 23 years for -1

 

GOAL: To be able to subtract from sysdate and the request show in yyyy-MM-dd format i.e. if I want someone to be 65 years old - i want to subtract from sysdate to get that.

Again this is an xml tag I'm populating the expression in.

 

Thank you,

Rob


Viewing all articles
Browse latest Browse all 20990

Trending Articles