Results 1 to 3 of 3

Thread: How to add a day suffix to a URL

  1. #1
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to add a day suffix to a URL

    Hi Folks,

    I am new to web design and am currently in the process of setting up a website for the team. I am just trying to do the basic stuff before I try to add complex functionality.

    There is an automated process which generates a report. The report is called exception_<day>.htm where <day> can be Mon, Tue, ......Sun etc depending on the day its generated.

    From my web page I want to be able to goto todays report. This is where my question comes in :

    Lets say my URL is http://abc.xyz.com/report/exception_<day>.url

    Is there a way of me being able to dynamically change the URL depending on the day. I have had a look on the web and people talk about using a database, PHP, etc. Due to time constraints I am looking for a quick and easy solution.

    Any help and/or advice greatly appreciated.

    BTW a similar issue exists with another report where the suffix is in the format YYMMDD.

  2. #2
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    You can use javascript to derive todays date and then format it to suit your needs.

    Here's a bit of one that I use, it enables me to build ddmmyyyy or dd-monthname-yyyy.

    Code:
    function showDate()
    {
    var mydate=new Date();
    var year=mydate.getYear();
    	if (year < 1000) {
    	year+=1900;
    	}
    var month=mydate.getMonth();
    var daym=mydate.getDate();
    	if (daym<10) {
    	daym="0"+daym;
    	}
    var montharray=["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août", "Septembre","Octobre","Novembre","Décembre"];
    var alphaDate=(daym+" "+montharray[month]+" "+year);
    var numDate=(daym+"/"+month+"/"+year);
    }
    Apologies for the month name being in French.

  3. #3
    Join Date
    May 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the code above.

    It will certainly come in handy for calculating the date in the format I require. Then I will experiment with trying to add the variable at the end of the URl.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •