DATEDIF

  • Last update:  2022-04-04
  • 1. Extracted data

    1)Overview

    SyntaxDATEDIF(start_date,end_date,unit)

    Returns the number of days, months, or years between two specified days.

    Note: 5.1.12 and later returns the difference between end_date and start_date, or a negative value if it is negative.

    Parameter1start_date

    Indicates the initial date of the specified period. Only text and date types are supported.

    Can be a series number in 1900, for example, 35796 is 1998-01-01.

    Parameter2end_date

    Indicates the end date of the specified period. Only text and date types are supported.

    Can be a series number in 1900, for example, 35796 is 1998-01-01.

    Parameter3unit

    The type of information returned by the function. 

    If unit= "Y/y", return the annual difference; 

    If unit= "M/m", return the monthly difference;

    If unit= "D/d", return the day difference; 

    If unit= "MD/md", the year and month are ignored and the day difference is returned; 

    If unit= "YM/ym", the year and day are ignored and the month difference is returned; 

    If unit= "YD/yd", the year is ignored and the day difference is returned

    2)Precautions

    • Supports three parameters, the previous two date or text type parameters, and the third requires text.

    • The third parameter supports Y, M, D, MD, YM, YD and is case insensitive.

    3)Example

    FormulaResultRemark
    DATEDIF("2001/2/28","2004/3/20","Y")3That is three years between February 28, 2001 and March 20, 2004.
    DATEDIF("2001/2/28","2004/3/20","M")37That is 36 full months between February 28, 2001 and March 20, 2004.
    DATEDIF("2001/2/28","2004/3/20","D")1116

    That is 1,116 days between February 28, 2001 and March 20, 2004.

    DATEDIF("2001/2/28","2004/3/20","md")-8
    Ignoring month and year, the difference between February 28, 2001 and March 20, 2004 is -8 days.
    DATEDIF("2001/1/28","2004/3/20","YM")2Ignoring day and year, the difference between January 28, 2001 and March 20, 2004 is 2 months.
    DATEDIF("2001/2/28","2004/3/20","yd")21Ignoring year, the difference between February 28, 2001 and March 20, 2004 is 21 days.
    DATEDIF(35796,35800,"MD")4Ignoring year and month, the difference between January 1, 1998 and January 5, 1998 is 4 days.

    2. Real-time data

    1)Overview

    GrammarDATEDIF(start_date,end_date,unit)

    Returns the number of days, months, or years between two specified days.

    Note: 5.1.12 and later returns the difference between end_date and start_date, or a negative value if it is negative.

    Parameter1start_date

    Indicates the initial date of the specified period. Only text and date types are supported.

    Parameter2end_date

    Indicates the end date of the specified period. Only text and date types are supported.

    Parameter3unit

    The type of information returned by the function. 

    If unit= "Y/y", return the annual difference; 

    If unit= "M/m", return the monthly difference;

    If unit= "D/d", return the day difference; 

    If unit= "MD/md", the year and month are ignored and the day difference is returned; 

    If unit= "YM/ym", the year and day are ignored and the month difference is returned; 

    If unit= "YD/yd", the year is ignored and the day difference is returned.

    2)Precaution

    • Three parameters are supported, the first and second are date or text type parameters, and the third is text type parameter.

    3)Example

    FormulaResultRemark
    DATEDIF("2001-02-28","2004-03-20","Y")3That is three years between February 28, 2001 and March 20, 2004.
    DATEDIF("2001-02-28","2004-03-20","M")37That is 36 full months between February 28, 2001 and March 20, 2004.
    DATEDIF("2001-02-28","2004-03-20","D")1116That is 1,116 days between February 28, 2001 and March 20, 2004.
    DATEDIF("2001-02-28","2004-03-20","md")-8
    Ignoring month and year, the difference between February 28, 2001 and March 20, 2004 is -8 days.
    DATEDIF("2001-01-28","2004-03-20","YM")2Ignoring day and year, the difference between January 28, 2001 and March 20, 2004 is 2 months.
    DATEDIF("2001-02-28","2004-03-20","yd")21Ignoring year, the difference between February 28, 2001 and March 20, 2004 is 21 days.


    附件列表


    主题: Advanced Data Analyis
    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