WEEK - Returning the Week Number of a Year

  • Last update: May 21, 2025
  • Overview

    Syntax

    WEEK(text/date/value,"F1"/"F7")

    Returns the week number of a given date within a year.

    Parameter 1

    text/date/value

    Represents the date entered.

    Parameter 2

    "F1"/"F7" (must be uppercase)

    Determines the date range for the first week of the year:

    • F1 determines that the week containing January 1st is the first week of the year, and the date range is from January 1st to the last day of that week.

    • F7 determines that the first complete week is the first week of the year, and the date range is from the start date to the end date of the first complete week.

    iconNote:

    1. The Week Start from setting on the decision-making platform determines whether the week begins on Sunday or Monday, which affects the date range of the first week.

    2: Currently, only F1 and F7 are supported.If F1 or F7 is not entered, the default value is F7.

    Type of the Returned Value

    Value

    Notes

    The WEEK() function allows the parameters to be left blank. If the parameters are empty, the function returns the corresponding week number of the current system server time for the current year.

    If any parameter is NULL, the result is NULL.

    Example

    • F1 means that the week starts from Monday, with the week containing January 1st as the first week, spanning from January 1st to the last day of that week.

    • F7 means that the week starts from Sunday, with the first complete week within the year as the first week. If the Monday of the week containing January 1st of the year falls in the previous year, that week is considered as the 52nd week of the previous year.

    Take 2021/01/03 as an example.

    If you set Week Start from to Monday on the platform, the following table describes specific content.

    Date
    2021-01-03Description2021-01-042021-01-05
    WEEK (with parameter F7)

    52

    Starting from Monday, the first complete week is from January 4th to January 10th, so the returned value is 52.

    1

    1

    WEEK (with parameter F1)

    1

    The first week starts from January 1st, so the first week is from January 1st to January 3rd.

    2

    2

    If you set Week Start from to Sunday on the platform:

    Date
    2021-01-03Description2021-01-042021-01-05
    WEEK (with parameter F7)

    1

    Starting from Sunday, the first complete week is from January 3rd to January 9th, so the returned value is 1.

    1

    1

    WEEK (with parameter F1)

    2

    The first week starts from January 1st, so the first week is from January 1st to 2nd and the second week is from January 3rd to 9th.

    2

    2


    Other examples:

    FormulaResultNote

    WEEK()

    52

    The corresponding system server time is 2010-01-01 15:36:25.

    WEEK("2010/1/1")

    52


    WEEK("2010/1/1","F1")

    1


    WEEK("2010/1/6")

    1


    WEEK(35796)

    52



    附件列表


    主题: 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