Format Date as Week number?


Can we format a date as a week number (iso 8601) via Docentric Design?

Thank you

Hello, and welcome to Docentric forum.

While it is not possible to directly format a date as a week number on the template level, it is possible to do so in X++ and introduce the week number as a new data field.

To convert a date to a week number, please follow Microsoft’s documentation:

Look at the wkOfYr() method and the code example.

You can also use the Global::weekOfYear (date) method.

You then need to add the new data field (e.g., @WeekNumber) to the report data source, and you will be able to use it on the template.

Hi @JernejV

Thank you for your answer. We will do this in dsp report :+1:

Have a nice day

1 Like

Hi Patrick, that sounds like a good plan!

If you have any insights or experiences to share after implementing it, feel free to contribute to the forum. Your input can be valuable for others. Thanks and have a wonderful day!