FORMAT - Format Conversion

  • Last update:July 25, 2023
  • Overview

    In scenarios where frequent format conversion is required during data analysis, FineBI provides the FORMAT function specially for field formatting.

    Grammar

    FORMAT(object,format)

    Returns an object in a specified format.

    Parameter 1

    object

    Object to be formatted, the type of which can be String, Number, or Object (Date, Time commonly used)

    iconNote:
    Real-time data in (if any) object can only be of the date type.

    Parameter 2

    format

    Object format

    Notes

    • The function supports two parameters. For extracted data, the first parameter can be of any type and the second is of the text type.

    • For real-time data, the first parameter is of the date type and the second is of the text type.

    • To format date through the FORMAT function, date must be in yy/yyyy - M/MM - d/dd format.

    • The FORMAT function is not supported for the direct connect Kyligence database (enterprise edition).

    Example

    The following section takes 2021-06-15 as an example to introduce common FORMAT parameters, including date-type and numeric parameters.

    Date Format Parameter

    Format ParameterOutput
    D
    166
    DD166
    M6
    MM06
    MMMJune
    MMMMJune
    YY21
    YYYY2021
    YYYYMM202106
    MM/dd/yyyy06/15/2021
    M-d-yy6-15-21
    EEEEE, MMMMM dd, yyyyTuesday, June 15, 2021
    h:mm:ss a12:00:00 A.M.

    For example, if you want to remove the hour data from the date string,

    you can create a new formula column, name it, and enter the formula TODATE(FORMAT(column to be formatted,"yyyy-MM-dd")). The result is shown in the figure below.

    FORMAT.png

    Numeric Format Parameter

    Take 1234.56 as an example.

    Parameter Format
    FormulaOutput
    #,##0.00FORMAT(1234.5, "#,##0.00")1234.50
    "#,##0FORMAT(1234.5, "#,##0") 1234
    ¥#,##0.00FORMAT(1234.5, "¥#,##0.00") ¥1234.50
    0%FORMAT(1.5, "0%") 150%
    0.000%FORMAT(1.5, "0.000%")150.000%
    ##0.0E0FORMAT(6789, "##0.0E0") 6.789E3
    0.00E00FORMAT(6789, "0.00E00")6.79E03

    Combination with Other Functions

    FormulaResultNotes
    FORMAT(date(2007,1,1), "EEEEE, MMMMM dd, yyyy")Monday, January 01, 2007
    FORMAT(date(2007,1,13), "MM/dd/yyyy") 01/13/2007
    FORMAT(date(2007,1,13), "M-d-yy") 1-13-07
    FORMAT(time(16,23,56), "h:mm:ss a") 4:23:56 P.M.


    附件列表


    主题: Advanced Data Analysis
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    9s后關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy