JSFiddle - React, Tailwind, and code Playground

by Codi Bezouka-Smith

JavaScript

const date = new Date();
const format = {
	date: {
		day: () => { return ('0' + date.getDate()).slice(-2) },
		hours: date.getHours(),
		minutes: date.getMinutes(),
		month: () => { return ('0' + date.getMonth() + 1).slice(-2) },
		seconds: date.getSeconds(),
		year: date.getFullYear(),
	},
};
console.log(`${format.date.year}-${format.date.month()}-${format.date.day()} ${format.date.hours}:${format.date.minutes}:${format.date.seconds}`);