chinese-datetime-formatter

0.3.0 • Public • Published

Chinese Date Time Formatter

npm npm npm npm Build Status Coverage Status

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 of 2010-12-25 23:08:09 or 2010/12/25 23:08:09
  • format: string - Format string as the unicode CLDR documentation.
  • locale: string - Default as zh, if specified as zh-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

Readme

Keywords

none

Package Sidebar

Install

npm i chinese-datetime-formatter

Weekly Downloads

2

Version

0.3.0

License

MIT

Last publish

Collaborators

  • fengerzh