Jump to content

ender

Members
  • Posts

    7
  • Joined

  • Last visited

ender's Achievements

Newbie

Newbie (1/7)

5

Reputation

  1. Perhaps this will help : CSS3 Multiple Columns - W3Schools
  2. I have further amended the code as follows to get the format Wed Oct 12 2016 : function PutDateModified() { var dateString = document.lastModified.substr(0, document.lastModified.lastIndexOf(" ")); var date = new Date(dateString) var d = date.toDateString() // var l = date.toLocaleString("en-GB") // console.log(date.toLocaleString() document.write('<div style="font-size: 0.9em; text-align:right; color: blue;;">'); document.write("<i>Page Last Updated: " + d + "</i>"); document.write("</div>"); }
  3. This code is now working with the function in a .js document : function PutDateModified() { var dateString = document.lastModified.substr(0, document.lastModified.lastIndexOf(" ")); var date = new Date(dateString) var l = date.toLocaleString("en-GB") // console.log(date.toLocaleString() document.write('<div style="font-size: 0.9em; text-align:right; color: blue;;">'); document.write("<i>Page Last Updated: " + l + "</i>"); document.write("</div>"); } Thank you for the help.
  4. Hello again. I achieved a GB locale format by putting this code at the bottom of another page, defining a paragraph id ("datemod") and adding a paragraph class (p.dm) to the .css document. It shows the date string in the document in GB format but, unfortunately, with a zero time which I don't want. <script type="text/javascript"> var dateString = document.lastModified.substr(0, document.lastModified.lastIndexOf(" ")); var date = new Date(dateString) var l = date.toLocaleString("en-GB") var s = "<i>Document last updated: " + l + "</i>" document.getElementById("datemod").innerHTML=s; </script>
  5. Thank you. The code I have displays the date in US format and includes a zero number for time. function PutDateModified() { var date = document.lastModified.substr(0, document.lastModified.lastIndexOf(" ")); var d = new Date(date) var l = d.toLocaleString("en-GB") document.write('<div style="font-size: 0.9em; text-align:right; color: blue;;">'); document.write("<i>Page Last Updated: " + l + "</i>"); document.write("</div>"); } If I use your code, nothing is displayed in Firefox : function PutDateModified() { var dateString = document.lastModified.substr(0, document.lastModified.lastIndexOf(" ")); var date = new Date(dateString) console.log(date.toLocaleString() document.write('<div style="font-size: 0.9em; text-align:right; color: blue;;">'); document.write("<i>Page Last Updated: " + l + "</i>"); document.write("</div>"); }
  6. Thank you. Is there any way I can alter that line so that the string is in en-GB format? I have instantiated a date object using var d = new Date(date) but I haven't been able to use the components date, month and full year to create a string recognised by Firefox.
  7. Hello. I am using the following script to add a note to the top of the document of the date when the document was last modified. I have attempted to set the format to the GB locale but the date is displaying in the US locale. function PutDateModified() { var date = document.lastModified.substr(0, document.lastModified.lastIndexOf(" ")); var d = date.toLocaleString("en-GB") document.write('<div style="font-size: 0.9em; text-align:right; color: blue;;">'); document.write("<i>Page Last Updated: " + d + "</i>"); document.write("</div>"); } I have tried using the methods getDate, getMonth and getFullYear and adding those values separately to what is written in the document but the result is not recognised by Firefox and nothing is displayed. What I tried was as follows : var gd = date.getDate() var gm = date.getMonth() var fy = date.getFullYear() //... document.write("<i>Page Last Updated: " + gd + "/" + gm + "/" + fy + "</i>"); Any help welcome
×
×
  • Create New...