Chinese Date Time Formatter
Date and time formatter with Simplified Chinese characters.
Read this in other languages: English, 简体中文.
Installation
$ npm install chinese-datetime-formatter
Usage
const dateFormat = require('chinese-datetime-formatter');
// Basic usage
dateFormat('2016-02-20 10:00:00', 'MMMd日 EEEE HH:mm');
// 2月20日 星期六 10:00
// With different week name
dateFormat('2016-02-20 10:00:00', 'MMMd日 (EEE)');
// '2月20日 (周六)'
// show full date string in Chinese characters
dateFormat('2016-02-20 10:00:00', 'yyyy年M月d日 EEEE HH:mm', 'zh-u-nu-native');
// '二〇一六年二月二〇日 星期六 一〇:〇〇'
Parameters
-
datetime
: string or Object - Date object or a string in format of2010-12-25 23:08:09
or2010/12/25 23:08:09
-
format
: string - Format string as the unicode CLDR documentation. -
locale
: string - Default aszh
, if specified aszh-u-nu-native
, use Chinese characters for date and time
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Acknowledgments
- Mostly based on globalizejs/globalize.