Search This Blog

Sunday 22 July 2018

2. 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(date_obj)
        {
            var theday = date_obj.getDate();
            var themonth = months[date_obj.getMonth()];
            var theyear = date_obj.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