Skip to content

Instantly share code, notes, and snippets.

@ziadoz
Created July 9, 2024 11:13
Show Gist options
  • Save ziadoz/db2d22f76ec3658ce46e18d445f9792f to your computer and use it in GitHub Desktop.
Save ziadoz/db2d22f76ec3658ce46e18d445f9792f to your computer and use it in GitHub Desktop.
JS - Get Hours, Minutes and Seconds from Date
console.log(
new Intl.DateTimeFormat('en-GB', { hour: 'numeric', minute: 'numeric', second: 'numeric' })
.formatToParts(new Date)
.map((part) => part.value)
.join('')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment