Class: Format

Format()

new Format()

格式化类
Source:

Methods

date(date, formatopt) → {*}

简单的日期格式化
Parameters:
Name Type Attributes Default Description
date Date Data 日期
format string <optional>
"-" string 默认-
Source:
Returns:
{string} 返回格式化后的日期
Type
*
Example
date(new Date()) => 2019-6-12 13:43:23

money(str, radixopt) → {*}

对金额进行千位分隔
Parameters:
Name Type Attributes Description
str string 需要格式化的金额
radix number <optional>
如果有小数位 保留[radix]位数
Source:
Returns:
{string} 返回格式化后的金额
Type
*
Example
money("1223547.68") => 1,223,547.68