var data = new Date();
var Hh, Mm, Ss, mm;
Hh = data.getHours() + ":"; Mm = data.getMinutes() + ":"; Ss = data.getSeconds() + ":"; mm = data.getMilliseconds() + ":"; document.write("Sono le ore " + Hh + Mm + Ss + mm);
//Funzioni per controllare correttezza di una data o di un orafunction isDate(dateStr) { var datePat = /^(\d{2})(\/|-)(\d{2})(\/|-)(\d{4})$/; var matchArray = dateStr.match(datePat); // is the format ok? var ret = true; if (matchArray == null) { //alert(“Please enter your birth date as dd/mm/yyyy. Your current selection reads: ” + dateStr); ret = false; } return ret; } function isHour(dateStr) { var datePat = /^(\d{2})(\:)(\d{2})$/; var matchArray = dateStr.match(datePat); // is the format ok? var ret = true; if (matchArray == null) { //alert(“Please enter your birth date as dd/mm/yyyy. Your current selection reads: ” + dateStr); ret = false; } return ret; }