Skip to content

数字

一份参考文档,列出了支持数字表达式数据转换的内置便利函数。

表达式中的 JavaScript

您可以在表达式中使用任何 JavaScript。有关更多信息,请参阅表达式

ceil():数字

Rounds up a number to a whole number.

floor():数字

Rounds down a number to a whole number.

格式(语言环境?:LanguageCode,选项?:FormatOptions):字符串

This is a wrapper around Intl.NumberFormat(). Returns a formatted string of a number based on the given LanguageCode and FormatOptions. When no arguments are given, transforms the number in a like format 1.234.

函数参数

localesOptionalString

IETF BCP 47 语言标签。

默认:

optionsOptionalObject

配置数字格式选项。更多信息请参阅MDN | Intl.NumberFormat()


isEven(): 布尔值

Returns true if the number is even. Only works on whole numbers.

isOdd(): 布尔值

Returns true if the number is odd. Only works on whole numbers.

四舍五入(小数位数?:数字):数字

Returns the value of a number rounded to the nearest whole number, unless a decimal place is specified.

函数参数

decimalPlacesOptionalNumber

四舍五入到小数点后几位。

默认:


toBoolean():布尔值

Converts a number to a boolean. 0 converts to false. All other values convert to true.

toDateTime(格式?:字符串):日期

Converts a number to a Luxon date object.

函数参数

formatOptionalString enum

可以是(毫秒)、 (秒) 或(Excel 1900)。默认为毫秒。