1<!doctype html>234<meta charset= "UTF-8" >5<title>Document</title>6<script>7 functionFormat (date) {8 varDays=["Day", "one", "two", "three", "four", "five", "six";//Create array days: ["Day",..., "six"]9 varY=date.getfullyear ();//get year, save in YTen varM=date.getmonth (+1);//get month, save in M in +1 Onem<10&& (m= "0" +m);//if m<10, it becomes 0+m. A varD=date.getdate ();//get date, save in D -d<10&& (d= "0" +d);//if d<10, it becomes 0+d. - varDay=days[date.getday ()];//get the week, and then get the kanji that corresponds to days, save in Day theConsole.log (y+ "year" +m+ "month" +d+ "Day Worship" +Day ); - - varH=date.gethours ();//get hours, save in H - varam; +H>=12?am= "Afternoon": "Morning";//declare variable AM, if h>=12, assign value to "PM" otherwise assign to "Morning" -h>12&& (H-=12);//if h>12, let h-12 +h<10&& (h= "0" +h);//if h<10, it becomes 0+h. A varM=date.getminutes ();//get minutes, save in M atm<10&& (m= "0" +m);//if m<10, it becomes 0+m. - returny+ "Year" +m+ "month" +d+ "+day+" "+am+h+": "+m; -}//May 10, 2016 Tuesday afternoon 6:13 -Console.log (Format (NewDate ())); -</script> - in<body> - to</body> +javascript--Formatting the current time