function myFunction() { var d = new Date(); var timeStamp = d.getTime(); // Number of ms since Jan 1, 1970 // OR: var currentTime = d.toLocaleTimeString(); // "12:35 PM", for instance }