The Week From DateTime function returns the week number of the year in which a specified datetime value occurs.
Use the Week From DateTime function to specify the week number when you want to group or sort dates by the week. For example, if you want to group publication dates by the week in which they were published and you want to delimit the weeks by the week number of the year.
Use the First week day
and the Minimum days in first week
parameters to identify the first week of the year. Different standards describe "week one" differently. For example, the ISO 8601 standard specifies that Monday is the first day of the week and that week one is the first week of the year with at least four days. In cases where a week spans December and January, the first days in January might be in week 53 of the preceding year.
First week day
Which day starts the week. The default first day of the week is Monday.Minimum days in first week
Valid values are 1-7. The default value is 4.Expression
The input datetime value.
For the Expression
parameter, choose one of the following actions:
- Specify a text value.
- Specify a function value.
- Use a variable to return the value.
- Specify a value from the Input tree.
parameter must be a datetime value or a string that can be cast to a datetime value in one of the default formats. If the Expression
parameter is not already a datetime value or is not in a default format, first convert it using the Create DateTime function.
You can choose from multiple return date formats or construct your own format.
Specifies the format for the year value:
The year value will not appear in the output.2001
The year value will be represented in four digits. This is the default year format.01
The year value will be represented in two digits.
The character that separates the year and week values:
hyphen (-) This is the default separator format.
space ( )
You can also type the characters to use for the separator.
Specifies the format for the week value:
Specifies the week number with the letter "W" followed by a two-digit value. This is the default week format.01 (two-digit)
Specifies the week number with two digits. The numbers 1-9 will have zeros prepended to them.1 (variable-length)
Specifies the week as one or two digits. The numbers 1-9 will not have zeros prepended to them.
A week number in the format that you specified.
The Week From DateTime function returns the week number in which a date occurs. The following are possible return values for January 1, 2010:
2009-W53 (ISO 8601 Week format)
2009W53 (ISO 8601 Week alternate format)
2010-01 (Set Minimum days in first week to 1)
2009 week 53 (Type " week " in the Separator parameter field.)
Week 53 (Set Year to "none". Type "Week " in the Separator parameter field.)
Parent topic: Builtin functions: imc3
Week Starting Date function: imc3
Supported date formats: imc3