8

Is it possible, or how to do it - to have bookmark (bookmarklet?) that, when clicking would open new page, that would have 2 parameters calculated based on current date?

For example, today it would open:

http://some.site/page?from=2011-11-01&to=2011-11-28

but in a week it would be

http://some.site/page?from=2011-12-01&to=2011-12-05
fixer1234
  • 28,064

1 Answers1

5

Thanks for the opportunity to learn something! Here's what I came up with. Create a bookmark with the following in the Location field.

javascript:function z() { var d = new Date(); ym = d.getFullYear() + '-' + (d.getMonth()+1) + '-'; return 'http://some.site/page?from='+ym+'01&to='+ym+d.getDate(); } window.open(z(),"_blank");

It looks like you wanted from the first of the current month to the current date, correct?

Alan
  • 116