How to get first 3 letters of a month name in JavaScript

2 Answers

0 votes
const date = new Date(2022, 6, 17);
 
const shortName = date.toLocaleString('en-US', {month: 'short'});
console.log(shortName); 
    
    
    
/*
run:
    
"Jul"
    
*/
 

 



answered Jun 14, 2022 by avibootz
0 votes
const date = new Date(2022, 0, 17);

const shortName = date.toLocaleString('en-US', {month: 'short'});
console.log(shortName); 
   
   
   
/*
run:
   
"Jan"
   
*/

 



answered Jun 14, 2022 by avibootz

Related questions

2 answers 194 views
2 answers 133 views
1 answer 121 views
1 answer 122 views
1 answer 124 views
1 answer 131 views
...