Wednesday, January 15, 2014

Get the current date in JavaScript

<script type="text/javascript">
    var currentDate = new Date()
    var day = currentDate.getDate()
    var month = currentDate.getMonth() + 1
    var year = currentDate.getFullYear()
    document.write("<b>" + day + "/" + month + "/" + year + "</b>")
</script>
The result will be like
15/1/2014
More: