# ISO8601 year week formatting

**URL:** <https://discourse.julialang.org/t/iso8601-year-week-formatting/127065>\
**Category:** General Usage\
**Tags:** dates\
**Created:** [March 17, 2025, 5:04pm UTC](https://discourse.julialang.org/t/iso8601-year-week-formatting/127065 "2025-03-17T17:04:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonjilla](https://avatars.discourse-cdn.com/v4/letter/j/7ba0ec/32.png) [@jonjilla](https://discourse.julialang.org/u/jonjilla)\
**Post date:** [March 17, 2025, 5:04pm UTC](https://discourse.julialang.org/t/iso8601-year-week-formatting/127065/1 "2025-03-17T17:04:42Z")

</div>

Hello All

This seems like it should be a very common situation, but I cannot seem to find a standard function in Dates to return the ISO 8601 Year and Week in Julia? The week number is correct, but It doesn’t seem to return the correct year.

in SQL, the date format would be ‘IYYY-IW’ which would return 2025-01 for Dec 31, 2024.

Is there a formatting code that I am missing from the documentation for the ISO8601 Year?

---

<div class="post-metadata">

**Author:** ![Degrande](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Degrande](https://discourse.julialang.org/u/Degrande)\
**Post date:** [March 25, 2025, 6:27am UTC](https://discourse.julialang.org/t/iso8601-year-week-formatting/127065/2 "2025-03-25T06:27:27Z")

</div>

you could just use the standard ‘2001-08-12’ with no special syntax needed and avoid the problem altogether. ISO-8601 or it’s invalid.

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [March 25, 2025, 6:52am UTC](https://discourse.julialang.org/t/iso8601-year-week-formatting/127065/3 "2025-03-25T06:52:58Z")

</div>

That doesn’t look like it prints the week number, though..

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [March 25, 2025, 9:21am UTC](https://discourse.julialang.org/t/iso8601-year-week-formatting/127065/4 "2025-03-25T09:21:52Z")

</div>

This seems like an omission in the Dates module. The ISO 8601 specifier for week number appears to be `Www`, but this is not supported by Dates.

There is a `week` function, so you can do `Dates.week(now())`, which does indeed return the ISO 8601 week number, but no built-in format string. You can write a custom function based on this, though.

---

<div class="post-metadata">

**Author:** ![Degrande](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Degrande](https://discourse.julialang.org/u/Degrande)\
**Post date:** [March 26, 2025, 4:20am UTC](https://discourse.julialang.org/t/iso8601-year-week-formatting/127065/5 "2025-03-26T04:20:43Z")

</div>

Okay.., now I got it. Thanks for clarify.
