Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/session/session.php on line 426

Warning: Cannot modify header information - headers already sent by (output started at /home/content/f/e/r/ferasferas1/html/scriptslibrary/libraries/joomla/database/database.php:2) in /home/content/f/e/r/ferasferas1/html/scriptslibrary/templates/ja_purity/ja_templatetools.php on line 49
Show Current Date in JavaScript - The Scripts Library Community

Free Programming Tutorials & Source Code

 
  • Increase font size
  • Default font size
  • Decrease font size
Home JavaScript Show Current Date in JavaScript

Show Current Date in JavaScript

E-mail
(0 votes, average: 0 out of 5)
This is a simple JavaScript code to place the current date onto your webpage. You can add it in the header of your document, or in a separate js file and call it wherever you want to show the date.

 

<SCRIPT LANGUAGE="JavaScript1.2">
var months=new Array(13);
months[1]="January";
  months[2]="February";
  months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
  months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
  months[11]="November";
months[12]="December";
var time=new Date();
  var cmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getYear();
if (year < 2000)
  year = year + 1900;
  document.write(cmonth + " ");
document.write(date + ", " + year);

</SCRIPT>