External module: dt时间操作
Index
Functions
Functions
format
▸ format(date: number
, type: 0
| 1
| 2
): string
Defined in dt/format.ts:19
将时间戳转为字符串
see: api
example:
import format from '@dfeidao/atom-mobile/dt/format';
const time = format(1550620800000, 0);// '2019-02-20'
Parameters:
Name | Type | Description |
---|---|---|
date | number |
时间戳 |
type | 0 | 1 | 2 |
转换类型,(0:yyyy-MM-dd,1:yyyy-MM-dd HH:mm:ss,2:yyyy-MM-dd HH:mm) |
Returns: string
string 时间字符串
parse
▸ parse(date: string
): number
Defined in dt/parse.ts:16
将字符串转化为时间戳
see: api
example:
import parse from '@dfeidao/atom-mobile/dt/parse';
const time=parse('2019-02-20'); // 1550620800000
Parameters:
Name | Type | Description |
---|---|---|
date | string |
自定义时间字符串 |
Returns: number
时间戳