How to set 1st as starting date of a Month & 30 as End date

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

How to set 1st as starting date of a Month & 30 as End date

by fody26 on Tue Dec 05, 2017 4:24 am

Hi,

I am currently working on a code that requires the start date to have the first date of the present month and the end date to be exactly one year from the start date. (Format below)

Dates (YYYY-MM-DD) should be:
Start date: 2017-11-01
End date: 2018-10-31 OR

Start date: 2017-12-01
End date: 2018-11-30 OR


'Date Range
EVENT TYPE=CLICK SELECTOR="#dateRange" BUTTON=0

'START DATE
'TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:daterangepicker_start CONTENT=EVAL("var today = new Date(); var nextyear = new Date(); nextyear.setDate(today.getDate() + 0); var day = nextyear.getDate().toString(); if (day.length < 2) {day = \"0\" + day;} var month = (nextyear.getMonth() - 1).toString(); if (month.length < 2) {month = \"0\" + month;} var year = nextyear.getFullYear().toString(); year+month+day;")

'END DATE
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:daterangepicker_end CONTENT=TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:daterangepicker_end CONTENT=EVAL("var today = new Date(); var nextyear = new Date(); nextyear.setDate(today.getDate() + 30); var day = nextyear.getDate().toString(); if (day.length < 2) {day = \"0\" + day;} var month = (nextyear.getMonth() + 12).toString(); if (month.length < 2) {month = \"0\" + month;} var year = nextyear.getFullYear().toString(); year+month+day;")

TAG POS=1 TYPE=BUTTON ATTR=TXT:Apply

Any help on this would be greatly appreciated

Thanks
fody26
 
Posts: 1
Joined: Tue Dec 05, 2017 4:08 am

Return to iMacros for Firefox

Who is online

Users browsing this forum: No registered users and 12 guests

-->