Dates

From Edgar BV Wiki
Jump to navigation Jump to search

To get dates in MM/DD/YYYY format you can either use javascript as a target or store them.

using javascript as a target

command: type

Target: id=fieldname

value: javascript{var d = new Date (); d.setDate ( d.getDate() + 0); ( (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear() );}

In order to go into the past or future you can add days to the d.getDate function, so the 0 changes to the amount of days in the future. This will automatically roll over months and years. Eg 22 days from now is

value: javascript{var d = new Date (); d.setDate ( d.getDate() + 22); ( (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear() );}

You can also go to the past with

value: javascript{var d = new Date (); d.setDate ( d.getDate() - 5); ( (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear() );}

Storing the dates in variables for later use

command: storeEval

Target: {((new Date()).getMonth()+1)+'/'+(new Date()).getDate()+'/'+(new Date()).getFullYear()}

value: date

In order to get the date shown in a field it would be something like:

command: type

Target: id=fieldname

value: ${date}

HOWEVER If you want to have a date in the future you can increment the numbers but this does not lead to the months / days / years rolling over, you just get higher numbers.