Results 1 to 4 of 4

Thread: Display date on website

  1. #1
    Join Date
    Jul 2005
    Location
    Serbia & Montenegro
    Posts
    71

    Default Display date on website

    How to display date on website>

    Get date script>

    Code:
     <SCRIPT LANGUAGE="JavaScript" type="text/javascript">
      <!--
      function returnDate() {
        var this_month = new Array(12);
        this_month[0]  = "January";
        this_month[1]  = "February";
        this_month[2]  = "March";
        this_month[3]  = "April";
        this_month[4]  = "May";
        this_month[5]  = "June";
        this_month[6]  = "July";
        this_month[7]  = "August";
        this_month[8]  = "September";
        this_month[9]  = "October";
        this_month[10] = "November";
        this_month[11] = "December";
    
        var this_day = new Array(7);
        this_day[0]  = "Sunday";
        this_day[1]  = "Monday";
        this_day[2]  = "Tuesday";
        this_day[3]  = "Wednesday";
        this_day[4]  = "Thursday";
        this_day[5]  = "Friday";
        this_day[6]  = "Saturday";
    
        var today = new Date();
        var day   = today.getDate();
        var month = today.getMonth();
        var year  = today.getYear();
        var weekday = today.getDay();
        if (year< 1900) 
          year += 1900;
        SrcStr = (this_day[weekday]+", "+day+" "+this_month[month]+", "+year);
        document.write(SrcStr);	  
      }
      // -->
    </script>
    and to display>

    Code:
     <script language="JavaScript" type="text/javascript">returnDate();</script>
    Easy !!!

  2. #2
    Join Date
    Jul 2005
    Posts
    15

    Default

    Thanks very nice code its clean and easy to understand i love it!

  3. #3
    Join Date
    Aug 2004
    Location
    USA
    Posts
    996

    Default

    Aww elementry.

    Nice though I wouldn't give that kind of code away.

  4. #4
    Join Date
    Apr 2005
    Posts
    56

    Default

    Nice Script again Zoli dear !!

    :D :D :D

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •