Create Date Automatic with Flow Variable

Hello Mr/Mrs,

I just use knime a few days ago. anyone can suggest me for solve my problem. I want to create date use Create Date&Time Range Node automatically with flow variable. The workflow can be like this.

  1. Report that I do on November, then automatically create date from October,1 - October 31.
  2. Report that I do on December, then automatically create date from November,1 - November 30.
    and so on.
    here I also show the output what I want.

    I have idea to month from use excecution time minus by 1 but I confused to execute that.
    sorry if my english not good enough.

big thanks,
Nanda

You could use R and the seq() function to do this

knime.out <- as.data.frame(seq(as.Date(“2019/10/01”), as.Date(“2019/10/31”), “days”))
names(knime.out)[1] <- “list_days”

knime.out$list_days <- as.character(knime.out$list_days)

kn_example_sequence_days_in_month.knwf (13.5 KB)

edit: Extended version that also determines the first and last day of current month:

2 Likes

Hi @Nanda_Rukmana -

Here’s an example workflow that should do what you need, based on KNIME nodes only (if you don’t want to use R).

2019-10-31%2012_51_51-KNIME%20Analytics%20Platform

If I run it today (October 31), all the days in September 2019 are returned:

3 Likes

Hi there @Nanda_Rukmana,

to add my solution as well (similar to one @ScottF provided already). I decided to use Column Expressions node to determine the first day of previous month.

https://kni.me/w/-KYIGjuZiK3HAOOF

Additionally this seems as a frequent request. Not exactly this one but some kind of date creation/manipulation based on execution point in time. Hopefully we will figure out a way to make this easier in KNIME. Or someone maybe willing to create a Component? :slight_smile:

Br,
Ivan

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.