Skip to content

Instantly share code, notes, and snippets.

@xx7y7xx
xx7y7xx / timestamp.js
Last active Aug 11, 2017 — forked from hurjas/timestamp.js
Print out a nicely formatted timestamp in JavaScript.
View timestamp.js
/**
* Return a timestamp with the format "yyyy-m-d h:MM:ss TT"
* @type {Date}
*/
function timeStamp() {
// Create a date object with the current time
var now = new Date();
// Create an array with the current month, day and time