Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to format datetime in javascript

const d = new Date.now;
const ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(d);
const mo = new Intl.DateTimeFormat('en', { month: 'short' }).format(d);
const da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(d);
console.log(`${da}-${mo}-${ye}`);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #format #datetime #javascript
ADD COMMENT
Topic
Name
5+8 =