Author Topic: How to Add Dates in Webpages?  (Read 161 times)

0 Members and 1 Guest are viewing this topic.

Offline Corps

  • Sr. Member
  • *
  • Posts: 274
  • Karma: +0/-0
    • View Profile
How to Add Dates in Webpages?
« on: October 25, 2008, 07:54:27 AM »
JavaScript code will add the current date (based on the user’s system date/time) to any webpage:

Code: [Select]
<script>
  var mydate=new Date()
  var year=mydate.getYear()
  if (year < 1000)
    year+=1900
    var day=mydate.getDay()
    var month=mydate.getMonth()
    var daym=mydate.getDate()
  if (daym<10)
    daym="0"+daym
    var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday",
                                    "Thursday","Friday","Saturday")
    var montharray=new Array("January","February","March","April",
                            "May","June","July","August","September",
                            "October","November","December")
  document.write("<small><font color=\'000000\' face=\'Arial\'>"
                +dayarray[day]+", "+montharray[month]+" "+daym+",
                "+year+"
</font></small>")
</script>

Techronnati | where technology never sleeps

How to Add Dates in Webpages?
« on: October 25, 2008, 07:54:27 AM »

Mountain View

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
136 Views
Last post April 02, 2009, 06:42:14 AM
by CyborgRepublic
3 Replies
172 Views
Last post September 10, 2014, 08:02:09 AM
by CyborgRepublic
1 Replies
246 Views
Last post October 28, 2016, 02:59:40 AM
by JusticeLeague

Posting Disclaimer: Any individual may post a message in this forum and may do so anonymously. Therefore, the sole author is exclusively and entirely responsible for all opinions in that message. They do not represent the official opinions of Techronnati, its administrators or moderators or the Techronnati Management. Techronnati is merely acting as an impartial conduit for constitutionally protected free speech and is not responsible and will not be held liable for the content of such messages. All images and service logos are trademarks of their respective owners.