Skip to content

Latest commit

 

History

History
65 lines (41 loc) · 2.39 KB

File metadata and controls

65 lines (41 loc) · 2.39 KB
title description author ms.author ms.topic ms.date ms.reviewer audience ms.search.region ms.search.validFrom ms.search.form ms.dyn365.ops.version ms.assetid
WEEKNUM ER function
Learn about how the WEEKNUM Electronic reporting (ER) function is used, including syntax strings, arguments, return values, usage notes, and examples.
kfend
filatovm
article
01/15/2022
johnmichalak
IT Pro
Global
2021-12-03
ERDataModelDesigner, ERExpressionDesignerFormula, ERMappedFormatDesigner, ERModelMappingDesigner
AX 10.0.24

WEEKNUM ER function

[!include banner]

The WEEKNUM function returns an Integer value that represents the week of the year that includes a specified Date value. The calculation is based on culture-dependent rules that define a calendar week and the first day of the week.

Syntax

WEEKNUM (date, culture) as Integer

date: Date

A date value that represents the date to use to calculate the week of the year.

culture: String

The culture to use for the calculation. You can use culture codes that are supported in accordance with .NET standards.

Return values

Integer

The resulting numeric value.

Usage notes

The week of the year is calculated based on the ISO 8601 standard, if this standard has been adopted by a country or region that the locale is provided for at runtime. Otherwise, the calculation is based on country/region-specific national standards.

If an unsupported culture code is provided as an argument of the WEEKNUM function at runtime, an exception is thrown. If the blank string is provided as a culture code, the English country/region-neutral calendar is used to calculate the week number.

Examples

WEEKNUM (DATEVALUE ("01-01-2020", "de")) returns 1.

WEEKNUM (DATEVALUE ("01-01-2021", "de")) returns 53.

WEEKNUM (DATEVALUE ("01-01-2022", "de")) returns 52.

WEEKNUM (DATEVALUE ("01-01-2022", "ar")) returns 21.

Additional resources

Date and time functions

[!INCLUDEfooter-include]