Page last updates to show day,date,month and time

  • Quartzman
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Dec 07, 2008
  • Posts: 10
  • Status: Offline

Post August 27th, 2009, 2:36 pm

I have just completed a large website and the only problem I have is with the "Page last updated" operation. I have a update.js file plus the following on each page:-

Code: [ Select ]
  <script language="JavaScript" type="text/javascript">
     //<!--
     document.write("<center> Last Update: ");
     document.writeln(DocDate(),"<\/center>");
     // -->
    </script>
  1.   <script language="JavaScript" type="text/javascript">
  2.      //<!--
  3.      document.write("<center> Last Update: ");
  4.      document.writeln(DocDate(),"<\/center>");
  5.      // -->
  6.     </script>


The above gives me:- Last Update: Sunday 23 August, 2009

I used this system on my old website and it worked fine. The above now however updates each day (real date) Perhaps the update.js file has been corrupted in some way (I don't know how). What I would like is something like the following:-

Page last updated Thursday 27 August 2009 09:45pm (this needs to be BST)

Can someone please advise me. I have spent some time looking through this forum site but can't find the answer.

The new website has been built using XHTML that's the main differance.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 27th, 2009, 2:36 pm

  • mindfullsilence
  • Professor
  • Professor
  • User avatar
  • Joined: Aug 04, 2008
  • Posts: 846
  • Status: Offline

Post August 27th, 2009, 2:49 pm

what's in your update.js file? Could you post the code?
Use your words like arrows to shoot toward your goal.
  • Quartzman
  • Newbie
  • Newbie
  • No Avatar
  • Joined: Dec 07, 2008
  • Posts: 10
  • Status: Offline

Post August 27th, 2009, 9:40 pm

Code: [ Select ]
function getLongDateString()
{    //method defined on class Date.
    //Returns a date string of the form: Day DD Month,YYYY
    //(e.g. Sunday 27 September, 1998)
    monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
    dayOfWeek = this.getDay();
    day = dayNames[dayOfWeek];
    dateOfMonth = this.getDate();
monthNo = this.getMonth();
    month = monthNames[monthNo];
year = this.getYear();
    if (year < 2000)
year = year + 1900;
dateStr = day+" "+dateOfMonth+" "+month+", "+year;
    return dateStr;
}
//register the method in the class Date
Date.prototype.getLongDateString=getLongDateString;

function DocDate()
{ //return the document modification date (excl.time)
//as a string
    DateTimeStr = document.lastModified;
    secOffset = Date.parse(DateTimeStr);
    if (secOffset == 0 || secOffset == null) //Opera3.2
             dateStr = "Unknown";
    else
    {
        aDate = new Date();
        aDate.setTime(secOffset);
        //use method defined above
        datestr = aDate.getLongDateString();
    }
    return dateStr;
}
  1. function getLongDateString()
  2. {    //method defined on class Date.
  3.     //Returns a date string of the form: Day DD Month,YYYY
  4.     //(e.g. Sunday 27 September, 1998)
  5.     monthNames = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  6. dayNames = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
  7.     dayOfWeek = this.getDay();
  8.     day = dayNames[dayOfWeek];
  9.     dateOfMonth = this.getDate();
  10. monthNo = this.getMonth();
  11.     month = monthNames[monthNo];
  12. year = this.getYear();
  13.     if (year < 2000)
  14. year = year + 1900;
  15. dateStr = day+" "+dateOfMonth+" "+month+", "+year;
  16.     return dateStr;
  17. }
  18. //register the method in the class Date
  19. Date.prototype.getLongDateString=getLongDateString;
  20. function DocDate()
  21. { //return the document modification date (excl.time)
  22. //as a string
  23.     DateTimeStr = document.lastModified;
  24.     secOffset = Date.parse(DateTimeStr);
  25.     if (secOffset == 0 || secOffset == null) //Opera3.2
  26.              dateStr = "Unknown";
  27.     else
  28.     {
  29.         aDate = new Date();
  30.         aDate.setTime(secOffset);
  31.         //use method defined above
  32.         datestr = aDate.getLongDateString();
  33.     }
  34.     return dateStr;
  35. }

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 127 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.