formatter
Get a formatted date. Demo preview.
Install
$ npm install --save @uiw/formatter
Usage
; console;//=> 2019-03-07 console;//=> 2019-03-07 console//=> 2019年04月07日console//=> 2019年04月07日 16:30:29 console;//=> 2019console;//=> 2019
Or manually download and link formatter.js in your HTML, It can also be downloaded via UNPKG:
The above example preview.
timeZoneConverter
Resolve changes in time zone, resulting in inaccurate display server time
{ const oldDate = date; const newDate = ; const stamp = oldDate; if !timeZone return oldDate; return && !timeZone ? oldDate : stamp + newDate * 60 * 1000 + timeZone * 60 * 60 * 1000;}
API
;formatter;
Supported Patterns
rule | Description | 中文说明 | E.g |
---|---|---|---|
YYYY |
full year | 年 | 2019 |
MM |
month | 月 | 02 |
DD |
day | 天 | 05 |
HH |
hours | 时 | 12 |
mm |
minutes | 分钟 | 59 |
ss |
seconds | 秒 | 09 |
ms |
milliseconds | 毫秒 | 532 |