function formatFullDate() {
let now = new Date();
let allMonths = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
let month = allMonths[now.getMonth()];
let date = now.getDate();
let year = now.getFullYear();
return `${date} ${month} ${year}`;
function formatDayAndTime() {
let now = new Date();
let allDays = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday",
];
let dayOfWeek = allDays[now.getDay()];
let hour = ("0" + now.getHours()).slice(-2);
let minutes = ("0" + now.getMinutes()).slice(-2);
return `${dayOfWeek} ${hour}:${minutes}`;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter