Search This Blog

Monday 29 November 2021

3. Create a webpage to display system date in the given format: Ex: 01 January 2016

<HTML>

     <HEAD><TITLE> Display Date </TITLE>

     <SCRIPT language="JavaScript">

          var months = new Array(12);

          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";

         

          function CustomDate(m_date)

          {

              var theday = m_date.getDate();

              var themonth = months[m_date.getMonth()];

              var theyear = m_date.getYear()+1900;

              return theday + " " + themonth + " " + theyear;

          }

     </SCRIPT>

</HEAD>

<BODY bgcolor=beige text=green>

<center><font color=blue><H1>Webpage to Display System Date</H1></font></center>

     <H1>Today is:</H1>

<font size=22 color=magenta>

<SCRIPT>

          document.write(CustomDate( new Date()));

</SCRIPT>

</font>

</BODY>

</HTML>

No comments :

Post a Comment

FREE Hit Counters