add date into url as parameter

Posted on 2014-03-05
Last Modified: 2014-03-05
I have the following script that redirects a user to a web site.
I need to add yesterday's date to the end as paramater txtStartDate, i format 03/04/2014.  This way, each time someone clicks the link, the resulting page is already filtered for them.

<script type="text/javascript">
window.location.href = ""
Question by:drelinger
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 33

Accepted Solution

Big Monty earned 500 total points
ID: 39907013
LVL 33

Expert Comment

by:Big Monty
ID: 39907032
of course, to format it, you'll need to come up with some code for that as well:

<script type="text/javascript">
function getTommorrowsDate() {
var newDate = new Date() - 1;
var dd = newDate;
var mm = newDate.getMonth();

var yyyy = newDate.getFullYear();
if( dd< 10){ dd='0'+dd }
if( mm < 10){ mm='0'+mm }
return = mm+'/'+dd+'/'+yyyy;

window.location.href = "" + getTommorrowsDate()

Open in new window


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tools for analysis of code 4 44
ASP sending two datas 2 22
Hide and Unhide Table 6 24
AngularJS: ng-repeat 25 23
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question