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
link|improve this question

72% accept rate
Can't rattle off a specific solution off the top of my head, but yes, a JavaScript bookmarklet should be able to do this. – L2G Nov 28 '11 at 16:46
feedback

1 Answer

up vote 2 down vote accepted

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?

link|improve this answer
Thanks - exactly what I was looking for. – depesz Dec 1 '11 at 12:01
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.