You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Guillermo Muñoz Salgado <mu...@gmail.com> on 2022/04/28 11:59:17 UTC

Week of year calculation

Hi all,

We are working with a three nodes cluster running Apache NiFi 1.15.3 with
java openjdk version "1.8.0_292".

We need to calculate the current week of year with the next expression:

*${now():format("w",'Europe/Madrid')}*

We are getting as the result that today we are in the week number 18, and
it is not correct, we are in week 17. ¿Are we doing something wrong or is
it an issue or a well known bug?

Thanks!!
-- 
Guillermo Muñoz Salgado

Re: Week of year calculation

Posted by Guillermo Muñoz Salgado <mu...@gmail.com>.
Thanks, Josef.

What a world this one of weeks of year!!
I've been reading some literature ([1], [2]), and it seems the outlook's
way is the correct way, or at least the ISO 8601's compliant way. I feel
quite surprised/disappointed to discover that java is not ISO standard
compliant.

Thanks again for your view, Josef.

[1] https://en.wikipedia.org/wiki/ISO_week_date#First_week
[2]
https://stackoverflow.com/questions/68224273/last-week-number-of-year-in-default-java-is-not-correct

El jue, 28 abr 2022 a las 14:27, <Jo...@swisscom.com> escribió:

> Hi Guillermo
>
>
>
> Please check my screenshot from Microsoft Oulook calendar, you see that
> the 1. Januar is still in week 52. In java it seems that this behavior is
> different, the 1. January has been counted as number 1. So in outlook week
> 1 is in java week 2. Hope this helps.
>
>
>
> Cheers Josef
>
>
>
> [image: Background pattern Description automatically generated with low
> confidence]
>
>
>
> *From: *Guillermo Muñoz Salgado <mu...@gmail.com>
> *Reply to: *"users@nifi.apache.org" <us...@nifi.apache.org>
> *Date: *Thursday, 28 April 2022 at 13:59
> *To: *"users@nifi.apache.org" <us...@nifi.apache.org>
> *Subject: *Week of year calculation
>
>
>
> Hi all,
>
>
>
> We are working with a three nodes cluster running Apache NiFi 1.15.3 with
> java openjdk version "1.8.0_292".
>
>
>
> We need to calculate the current week of year with the next expression:
>
>
>
> *${now():format("w",'Europe/Madrid')}*
>
>
>
> We are getting as the result that today we are in the week number 18, and
> it is not correct, we are in week 17. ¿Are we doing something wrong or is
> it an issue or a well known bug?
>
>
>
> Thanks!!
>
> --
>
> Guillermo Muñoz Salgado
>


-- 
Guillermo Muñoz Salgado

Re: Week of year calculation

Posted by Jo...@swisscom.com.
Hi Guillermo

Please check my screenshot from Microsoft Oulook calendar, you see that the 1. Januar is still in week 52. In java it seems that this behavior is different, the 1. January has been counted as number 1. So in outlook week 1 is in java week 2. Hope this helps.

Cheers Josef

[Background pattern  Description automatically generated with low confidence]

From: Guillermo Muñoz Salgado <mu...@gmail.com>
Reply to: "users@nifi.apache.org" <us...@nifi.apache.org>
Date: Thursday, 28 April 2022 at 13:59
To: "users@nifi.apache.org" <us...@nifi.apache.org>
Subject: Week of year calculation

Hi all,

We are working with a three nodes cluster running Apache NiFi 1.15.3 with java openjdk version "1.8.0_292".

We need to calculate the current week of year with the next expression:

${now():format("w",'Europe/Madrid')}

We are getting as the result that today we are in the week number 18, and it is not correct, we are in week 17. ¿Are we doing something wrong or is it an issue or a well known bug?

Thanks!!
--
Guillermo Muñoz Salgado