2 Replies Latest reply on Feb 4, 2010 1:35 PM by John Waller

    Time Stamp in Dreamweaver

    mshef534 Level 1

      My question is two parts but I am going to start with the more simple part.


      I need the date and time to be stamped on the page when a viewer/user goes to the webpage. 


      I figured out how to use JavaScript to do a Date stamp but can not figure out how to add the time.


      If I get an answer to this, I will then ask my second part.




        • 1. Re: Time Stamp in Dreamweaver
          370H55V Level 4

          I use a simple vnu_datestamp.js to stamp the date and time according to the visitor's system settings.


          days = new Array(
          months = new Array(
          "January","February","March","April","May","June","July","August","September","October","N ovember","December"


          function renderDate(){
              var mydate = new Date();
              var year = mydate.getYear();
              if (year < 2000) {
                  if (document.all)
                      year = "19" + year;
                      year += 1900;
              var day = mydate.getDay();
              var month = mydate.getMonth();
              var daym = mydate.getDate();
              if (daym < 10)
                  daym = "0" + daym;
              var hours = mydate.getHours();
              var minutes = mydate.getMinutes();
              var dn = "AM";
              if (hours >= 12) {
                  dn = "PM";
                  hours = hours - 12;
              if (hours == 0)
                  hours = 12;
              if (minutes <= 9)
                  minutes = "0" + minutes;
              document.writeln("<FONT COLOR=\"#000000\" FACE=\"Verdana,arial,helvetica,sans serif\" size=\"1\"><B> Today is: ",days[day]," ",months[month]," ",daym," , ",year,"</B> | ",hours,":",minutes," ",dn,"</FONT><BR>");





          Just put all that into a js file, named vnu_datestamp.js


          and add <script language=javaScript src="js/vnu_datestamp.js"></script>  wherever you want it to be on the page(s).



          You can edit the blue parts to suit your own needs.

          • 2. Re: Time Stamp in Dreamweaver
            John Waller Adobe Community Professional & MVP

            Which time are you stamping on the page: local time where the user is? or the time at the server where the page is hosted? These could be 24 hours apart.


            Plus is the purpose of the time stamp to inform the user or for some other reason? I'm just curious about the goal of the exercise.