View Full Version : how to show time stamp

03-31-2010, 05:49 PM

every time I make an update to a web page using dream weaver I want to be able to time stamp the post when the page is saved. does anyone know how to do this?

i know there is the feature "insert date" but I just want to insert 1 piece of code that does it automatically.


04-01-2010, 12:09 AM
you need javascript
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"
RightNow = new Date()
var day = DaysofWeek[RightNow.getDay()] var date = RightNow.getDate() var Month = Months[RightNow.getMonth()] var Year = RightNow.getFullYear()
if (date == 1 || date == 21 || date == 31) {ender = "<SUP>st</SUP>"}
else if (date == 2 || date == 22) {ender = "<SUP>nd</SUP>"}
else if (date == 3 || date == 23) {ender = "<SUP>rd</SUP>"}
else {ender = "<SUP>th</SUP>"}
document.write("Today is " +day+ " " +Month+ " " +date+ ender+ ", " +Year+ ".") </SCRIPT>
or php

<? print(Date("l F d, Y")); ?> you can change this format as you want it to appear

04-01-2010, 02:36 AM
Use the insert date feature (menu: Insert>Date…) and in the Insert Date dialog check the Update automatically on save box.

04-01-2010, 06:36 PM
Better using PHP I think just in case Javascript is disabled in which case they won't work. Its just as easy to implement.

<?php ini_set('date.timezone', 'Europe/London');
echo date('l jS M Y'); ?>

04-01-2010, 06:56 PM
Don't both the javascript and php solutions just show the current date? I think he's after the date the file was last modified.

04-02-2010, 03:03 AM
in which case that can also be done with php