Generate Random Date

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
ghostpom12
Posts: 1
Joined: Wed Jul 04, 2018 2:50 am

Generate Random Date

Post by ghostpom12 » Wed Jul 04, 2018 2:57 am

SET !VAR1 EVAL("var d=new Date();d.setDate(d.getDate()-1);var year=d.getFullYear();var month=d.getMonth()+1;var day=d.getDate();year+'-'+month+'-'+day;")
'SET !VAR2 EVAL("var d=new Date();d.setDate(d.getDate()-180);var year=d.getFullYear();var month=d.getMonth()+1;var day=d.getDate();year+'-'+month+'-'+day;")
'SET !VAR3 EVAL("var randomNumber=Math.floor(Math.random()* {{!VAR2}} + {{!VAR1}}); randomDate;")
'SET !VAR3 EVAL("int days = Days.daysBetween(d1, d2).toDays(); LocalDate randomDate = d1.addDays(ThreadLocalRandom.nextInt(days+1));")
'ADD !EXTRACT {{!VAR1}}

SET !VAR2 EVAL("var randomNumber=Math.floor(Math.random()*"{{!NOW:yyyy/mm/dd_hhnn}}" + "{{!VAR1}}"); randomNumber;")
TAG POS=1 TYPE=INPUT:SEARCH FORM=ID:searchform ATTR=ID:searchInput CONTENT={{!VAR2}}
Post Reply