# Looking for a date function that can calculate the day of the year from a given date

**URL:** <https://discourse.processing.org/t/looking-for-a-date-function-that-can-calculate-the-day-of-the-year-from-a-given-date/42125>\
**Category:** Beginners\
**Created:** [June 2, 2023, 3:32pm UTC](https://discourse.processing.org/t/looking-for-a-date-function-that-can-calculate-the-day-of-the-year-from-a-given-date/42125 "2023-06-02T15:32:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)\
**Post date:** [June 2, 2023, 3:32pm UTC](https://discourse.processing.org/t/looking-for-a-date-function-that-can-calculate-the-day-of-the-year-from-a-given-date/42125/1 "2023-06-02T15:32:51Z")

</div>

I am looking for a date function that can calculate the day of the year from a given date (YYYYMMDD) eg. 20230603

Thanks for help/tips with coding.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 2, 2023, 3:57pm UTC](https://discourse.processing.org/t/looking-for-a-date-function-that-can-calculate-the-day-of-the-year-from-a-given-date/42125/2 "2023-06-02T15:57:19Z")

</div>

> **[Calendar.Builder (Java SE 17 & JDK 17)](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Calendar.Builder.html#build())**
>
> declaration: module: java.base, package: java.util, class: Calendar, class: Builder

[Calendar.get(DAY\_OF\_YEAR)](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Calendar.html#DAY_OF_YEAR)

---

<div class="post-metadata">

**Author:** ![proc8888](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@proc8888](https://discourse.processing.org/u/proc8888)\
**Post date:** [June 3, 2023, 1:03am UTC](https://discourse.processing.org/t/looking-for-a-date-function-that-can-calculate-the-day-of-the-year-from-a-given-date/42125/3 "2023-06-03T01:03:05Z")

</div>

> [@GoToLoop](#):
>
> Calendar.get(DAY\_OF\_YEAR)

Thank you for help with the code @GoToLoop
