Here myDate is the Date you want to subtract some days from.
And days before are the number of Days you wanna subtract.
I know you wanna subtract two dates instead but I think this would give you a start.
Alternately, you could use
record.trandate?date?
string.MM?number
record.trandate?date?string.DD?number
record.trandate?date?string.YYYY?number
to get these values and write custom logic to subtract these days. You can get these written in other languages(javascript/C#) and use them as sample to write your own code.