x
 
1
<!DOCTYPE html>
2
<title>My Example</title>
3
4
5
<time id="date"></time>
6
7
<script>
8
  /* 
9
  Create a JavaScript Date object for the current date and time,
10
  then extract the desired parts, then join them again in the desired format.
11
  */
12
  var currentDate = new Date(),
13
      day = currentDate.getDate(),
14
      month = currentDate.getMonth() + 1,
15
      year = currentDate.getFullYear(),
16
      date = day + "/" + month + "/" + year;
17
      
18
  // Output the date to the above HTML element
19
  document.getElementById("date").innerHTML = date;
20
</script>