- 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
廣告