Newbie here, and have picked up some helpful pointers from many of you. A problem I am experiencing is the "last date page modified" code. I already have the basics down, but trying to change the date to read "Day, Date, Time" in a format such as "February 16, 2007 3:00 PM" as opposed to the military time and hyphenated text. My current coding works, and have used the following but would like to refine it, if at all possible.
<script language="Javascript">
document.write("Field conditions updated on: " + document.lastModified +"")
</SCRIPT>
Any advice or help for this confused soul is greatly appreciated. Thank youI prefer <script type="text/javascript">
document.write ('<p>Last modified: ', new Date (document.lastModified).toLocaleString(), '<\/p>')
</script>But this follows your request:<script type="text/javascript">
Date.prototype.toString = function () {
return [['January ', 'February ', 'March ', 'April ', 'May ', 'June ', 'July ', 'August ', 'September ', 'October ', 'November ', 'December '] [this.getMonth()], this.getDate(), ', ', this.getFullYear(), ' ', this.getHours() > 12 ? this.getHours() - 12 : this.getHours(), ':', this.getMinutes() < 10 ? '0' + this.getMinutes() : this.getMinutes(), this.getHours() < 12 ? ' AM' : ' PM'].join('')
}
document.write ('<p>Last modified: ', new Date (document.lastModified), '<\/p>')
</script>I should add, however, that JavaScript has a tendency to not work for your users. So if this information is at all important then you need to use some server side method.Thank you very much....spent several hours last night, and with your advice I'm back on track. Will look into the suggestion about Javascript, though, to see how it performs in the next month.....thanks again !
<script language="Javascript">
document.write("Field conditions updated on: " + document.lastModified +"")
</SCRIPT>
Any advice or help for this confused soul is greatly appreciated. Thank youI prefer <script type="text/javascript">
document.write ('<p>Last modified: ', new Date (document.lastModified).toLocaleString(), '<\/p>')
</script>But this follows your request:<script type="text/javascript">
Date.prototype.toString = function () {
return [['January ', 'February ', 'March ', 'April ', 'May ', 'June ', 'July ', 'August ', 'September ', 'October ', 'November ', 'December '] [this.getMonth()], this.getDate(), ', ', this.getFullYear(), ' ', this.getHours() > 12 ? this.getHours() - 12 : this.getHours(), ':', this.getMinutes() < 10 ? '0' + this.getMinutes() : this.getMinutes(), this.getHours() < 12 ? ' AM' : ' PM'].join('')
}
document.write ('<p>Last modified: ', new Date (document.lastModified), '<\/p>')
</script>I should add, however, that JavaScript has a tendency to not work for your users. So if this information is at all important then you need to use some server side method.Thank you very much....spent several hours last night, and with your advice I'm back on track. Will look into the suggestion about Javascript, though, to see how it performs in the next month.....thanks again !