I'm completely new to the world of HTML.
I have an HTML file that contains a link similar to below:
<tr><a href=Report_201508_11Aug15.pdf>Report_11Aug15</a></tr>
the '201508_11Aug15' represents the date of the report.
Instead of hardcoding the date for each report, I would instead like to use a date function to locate the report and display a link for it.
so it would become
<tr><a href=Report_(Today's date in format above).pdf>Report_(Today's date in format above)</a></tr>
Please advise on how to achieve this? I would then want to go to older dates (e.g. Today's date - 1, -2, - 3 etc).
Thanks in advance.
if your are looking for client side solution you can do this using Javascript.
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var d = new Date();
var month = d.getMonth() + 1;
var name='Report_';
name+=d.getFullYear();
name+=month.toString().length==1?('0'+month):month;
name+='_';
name+=d.getDate()+1;
name+=monthNames[month];
name+=d.getFullYear().toString().substr(2);
name+='.pdf';
Fiddle: DEMO