Skip to content

Instantly share code, notes, and snippets.

View wanderrful's full-sized avatar

Wanderrful wanderrful

  • United States of America
View GitHub Profile
@wanderrful
wanderrful / timestamp.ts
Last active March 11, 2020 07:03 — forked from jonkemp/timestamp.js
Print out a nicely formatted timestamp in TypeScript.
export function fn_getTimeStamp(): Object {
// Create a date object with the current time
let now: Date = new Date();
// Create an array with the current month, day and time
let date: Array<String> = [ String(now.getMonth() + 1), String(now.getDate()), String(now.getFullYear()) ];
// Create an array with the current hour, minute and second
let time: Array<String> = [ String(now.getHours()), String(now.getMinutes())];
// If seconds and minutes are less than 10, add a zero
for (let i of time) {
if ( Number(i) < 10 ) {