I have a url that change every day based on today's date, for example:
http://www.newspaper.com/edition/20141227.html
where 20141227 is in the format YYYYMMDD.
Can I include the date using JavaScript? If possible, how would I do that?
I have a url that change every day based on today's date, for example:
http://www.newspaper.com/edition/20141227.html
where 20141227 is in the format YYYYMMDD.
Can I include the date using JavaScript? If possible, how would I do that?
Thanks for all the answers colleagues. For Dnyanesh, I tried the code in http://jsfiddle.net/ can work well. I try to enter into an html page like this, why can not run perfectly. Where is the mistake?
Thank you for all, all of the recommended code runs fine. If you want to put into the HTML code , add the following code to be loaded in the browser :
Here's a simpler method that works
This is as simple as it gets.
then paste the date in building the URL
url = "http://blahblahblaj.com/"+date
I think following steps will help you to achieve the functionality your are looking for
1.Convert the today's date or any date to intended format that is "YYYYMMDD" in your case.
2.Then append it to your URL.
Please look into code snippet for details. Note you just need to hover over URL to know what it is pointing to.
You can try the below code. Hope this helps.