kunal kunal - 4 years ago 155
jQuery Question

how to get shortname of month in moment.js?

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 :)

Answer Source

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>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download