TODATE - Converting a Data Type to Date

  • Last update: May 21, 2025
  • Overview

    Syntax

    TODATE(Parameter 1,[Parameter 2])

    Converts parameter values in various date formats to date types.

    The value of Parameter 1 can be a number, string, or date. [Parameter 2] is used to parse the date format, such as MM/dd/yy.

    Return Value Type

    Date

    For details about parameter usage, see the "Example" section.

    Notes

    • If any parameter value is NULL, the result is NULL.

    • In the format, the month must be uppercase MM, the year must be lowercase yy or yyyy, and the day must be lowercase dd.

    Example

    Formula
    ResultNote

    TODATE(DATE(2007,12,12))

    Returns the date object of December 12, 2007.

    (Only returns the value of Parameter 1.)

    The parameter value is returned directly as it is already of the date type.

     

    TODATE(1023542354746)

    Returns the date object of June 8, 2002.

    (Only returns the value of Parameter 1.)

    The function can convert timestamp data to date data.

    TODATE("2007/10/15")

    Returns the date object of October 15, 2007.

    (Only returns the value of Parameter 1.)

    The parameter value is a text in the date format, so the function returns the corresponding date.

    TODATE("1/15/07","MM/dd/yy")

    Returns the date object of January 15, 2007.(The month in Parameter 2 must be uppercase MM.)

    (Returns the value of Parameter 1, which is parsed by the format specified by Parameter 2.)

    The function contains two parameters. The value of the first parameter is a text in the date format, and the value of the second parameter is the format used to parse the date.

    In particular, yyyyMMdd is used to parse dates such as 20081230.For example, TODATE("20110830","yyyymmdd") returns the date of August 30, 2011.

    For example, add a New Calculation Column operator in a Data Transformation node and input the formula TODATE(1023542354746), as shown in the following figure.

    3-1.png

    The following figure shows the result.

    3-2.png

    Extension

    To convert a date in the yyyy-MM-dd HH:mm:ss format to the yyyy-MM-dd format, use a formula similar to TODATE(FORMAT(2023-06-13 00:01:27,"yyyy-MM-dd")).

    For more details about date formula syntax, see Common Date Formula.

     


    附件列表


    主题: Data Development - Scheduled Task
    Previous
    Next
    • Helpful
    • Not helpful
    • Only read

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

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

    不再提示

    10s後關閉

    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