Saturday, March 29, 2014

Display Current date using Javascript

<script type="text/javascript">
            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 montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
            document.write("<b class='date'>"+montharray[month]+" "+daym+", "+year+"</b>")
</script>

No comments:

Post a Comment