date function not working


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: date function not working

  1. #1
    Join Date
    Jan 2005
    Posts
    1

    date function not working

    hi

    Following is the page which contains date function :


    Name of File : checkdate.htm


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="javascript">

    //start display day/date code

    DaysofWeek = new Array()
    DaysofWeek[0]="Sunday"
    DaysofWeek[1]="Monday"
    DaysofWeek[2]="Tuesday"
    DaysofWeek[3]="Wednesday"
    DaysofWeek[4]="Thursday"
    DaysofWeek[5]="Friday"
    DaysofWeek[6]="Saturday"

    Months = new Array()
    Months[0]="January"
    Months[1]="February"
    Months[2]="March"
    Months[3]="April"
    Months[4]="May"
    Months[5]="June"
    Months[6]="July"
    Months[7]="August"
    Months[8]="September"
    Months[9]="October"
    Months[10]="November"
    Months[11]="December"


    function fixNumber(the_number){
    if (the_number < 10){
    the_number = "0" + the_number;
    }
    return the_number;
    }

    function fixPMHours(the_number){
    if (the_number>12){
    the_number = the_number - 12;
    }
    return the_number;
    }


    var dayVal;
    var timeVal=new Date()
    var m=timeVal.getMinutes()
    var h=timeVal.getHours()
    var fixed_hour = fixPMHours(h);
    var da=timeVal.getDate()
    var mo=timeVal.getMonth()
    var year=timeVal.getYear()
    var showDay=DaysofWeek[timeVal.getDay()]
    var showMonth=Months[timeVal.getMonth()]
    var fixed_minute = fixNumber(m);
    var the_time = fixed_hour + ":" + fixed_minute;
    var the_date = (" "+showMonth+" "+da+", "+year+" ")

    function showTime(){
    var timeValue = the_date+" "
    document.write(showDay+","+timeValue);
    }


    //end display day/date code

    </script>
    Today is
    <script language="javascript">
    showTime()
    </script>
    </head>

    <body>

    </body>
    </html>

    I have uploaded this file in two sites.

    Its working fine with one site only.

    url of the site which shows correct result is

    www.vanessamart.netfirms.com/checkdate.htm

    and the url where its not working is

    www.vanessamart.com/checkdate.htm

    Please help.

    Ishika

  2. #2
    Join Date
    May 2004
    Location
    Durham, UK
    Posts
    174
    Hi,

    Doing a compare on the scripts they look different.

    Download the working one back from the site and upload it to the site which isn't working.

    Hopefully it should solve your problem.
    Hope this helps
    Graham

    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, and if they get mad, you are a mile away and you have their shoes ;-)

    http://www.grahamrobinsonsoftware.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center