Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
86
rated 0 times [  91] [ 5]  / answers: 1 / hits: 40191  / 7 Years ago, mon, february 6, 2017, 12:00:00

i have successfully find the full name of month but i want short name of month. Can anyone help me. I am using Moment.js i have successfully find the month but i want in short form

here is my code :



var date = '<?php echo date(Y-m-d) ?>';
var Month = moment(date, 'YYY-MM-DD').format('DD/MMMM')
console.log(Month);


it returns me 06/February, But i want 06/Feb



Thanks in advance :)


More From » jquery

 Answers
106

You are not using correct format string, use MMM instead of MMMM see Docs





console.log(moment().format('DD/MMM'))

<script src=https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js></script>




[#59059] Friday, February 3, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kareem

Total Points: 733
Total Questions: 110
Total Answers: 102

Location: Bermuda
Member since Thu, Apr 20, 2023
1 Year ago
;