- MomentJS 教程
- MomentJS - 主页
- MomentJS - 概述
- MomentJS - 环境设置
- MomentJS - 介绍
- MomentJS - 解析日期和时间
- MomentJS - 日期验证
- MomentJS - 获取器/设置器
- 操作日期和时间
- 格式化日期和时间
- MomentJS - 日期查询
- MomentJS - 国际化
- MomentJS - 自定义
- MomentJS - 时段
- MomentJS - 工具
- MomentJS - 插件
- MomentJS - 示例
- MomentJS - 实用资源
- MomentJS - 快速指南
- MomentJS - 实用资源
- MomentJS - 讨论
MomentJS - 全局语言环境
我们可以在全局范围内分配语言环境,所有日期/时间信息都可在此分配的语言环境中获取。
语法
moment.locale(String); moment.locale(String[]); moment.locale(String, Object);
示例
moment.locale("hi");
var a = moment.duration(1, 'days').humanize();
var b = moment.duration(1, 'week').humanize();
输出
示例
moment.locale("hi");
var a = moment().fromNow();
输出
示例
moment.locale("pt");
var a = moment().locale();
输出
momentjs_internationalization.htm
广告