- MomentJS 教程
- MomentJS - 主页
- MomentJS - 概述
- MomentJS - 环境设置
- MomentJS - 介绍
- MomentJS - 解析日期和时间
- MomentJS - 日期验证
- MomentJS - 获取器/设置器
- 操作日期和时间
- 格式化日期和时间
- MomentJS - 日期查询
- MomentJS - 国际化
- MomentJS - 自定义
- MomentJS - 时长
- MomentJS - 实用程序
- MomentJS - 插件
- MomentJS - 示例
- MomentJS 实用资源
- MomentJS - 快速指南
- MomentJS - 实用资源
- MomentJS - 讨论
MomentJS - 长日期格式
此方法有助于自定义区域设置的长日期格式。
语法
moment.updateLocale('en', {
longDateFormat : Object
});
此处 longDateFormat 是包含与每种格式相对应的键值对的对象。
示例
var localeData = moment.updateLocale('fr', {
longDateFormat: {
LT: "h:mm",
LTS: "h:mm:ss A",
L: "MM/DD/YYYY",
l: "M/D/YYYY",
LL: "MMMM Do YYYY",
ll: "MMM D YYYY",
LLL: "MMMM Do YYYY LT",
lll: "MMM D YYYY LT",
LLLL: "dddd, MMMM Do YYYY LT",
llll: "ddd, MMM D YYYY LT"
}
});
var m = moment().format('LT');
var x = moment().format('LLLL');
输出
momentjs_customization.htm
广告