Skip to content

Instantly share code, notes, and snippets.

@ayoisaiah
Created May 31, 2025 06:55
Show Gist options
  • Save ayoisaiah/e5d88c8f2efa916f6fcc713f286ac0ff to your computer and use it in GitHub Desktop.
Save ayoisaiah/e5d88c8f2efa916f6fcc713f286ac0ff to your computer and use it in GitHub Desktop.
F
function format(date) {
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const year = date.getFullYear();
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
return `${year}${month}${day}T${hours}${minutes}${seconds}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment