Support Questions
Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

Nifi week of the year calculation


Hi all,

I nifi I have an attribute with filename from which I extracted date with substring (only yyyyMMdd portion).

After that I want to calculate year week number for date 2018/08/19 (formated from string portion 20180819024112) which is week number 33.

If I use format without specified timezone ('GMT'), I get week number 34, but with specified timezone I get correct week number 33. What is the difference? Why do I get wrong week number without timezone. GMT is only +2 hours from 19th of August Midnight.






New Contributor

Could it be that in GMT weeks start on Monday whereas weeks in your implicit timezone start on Sunday? Which timezone is your system set to?

Another thing to check could be what date you get when you use:

(...):format('yyyy-MM-dd HH:mm:ss', 'GMT')

Is it what you're expecting?


Timezone on my system is UTC+1 and first day of the week is Monday (also specified on my system).

With (...):format('yyyy-MM-dd HH:mm:ss', 'GMT') I get 2018-08-18 22:00:00, but without 'GMT' I get 2018-08-19 00:00:00.

Hello @Tomislav Novosel!
I tried to make the same test as you, but unfortunately, I got 34, even after removing the GMT.
Here's my template.

Also here's the step that I took:

su - nifi
mkdir -p /home/nifi/play_ts/cd /home/nifi/play_ts/touch 20180819024112

BTW, my timezone it's UTC. And my formula it's a little bit different from yours cause I'm skipping the getDelimitedFields.


Hope this helps.