目前我正在使用它进行日期格式化:
var format = moment().localeData(locale).longDateFormat("L");
return moment(dateObj).format(format);
地点可以是任何市场,例如。 en-US、fr-FR、en-GB 等...
但是,L
日期格式有 MM/DD/YYYY
(当然,它会因市场而异),我只需要 MM/DD
。我没有找到任何提供这种字符串的格式。有谁知道我如何才能实现所需的功能?
最佳答案
它可能比你正在寻找的更 hacky,但是......
var format = moment().localeData('en').longDateFormat("L");
moment().format(format).substr(0,moment().format(format).length-5);
关于javascript - 在 momentjs 中显示没有年份的长日期格式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32261171/