I have tried search unsuccessfully for a way to use a single node to pull out the hours information from multiple date time columns. the only solution I have figured out is to do do multiple Date Time extract nodes in series which isn’t very dynamic.
I guess this could be done with some type of Loop, but I was hoping there was a catch all node/component that could do this for multiple fields at once.
if the number and names of the columns is fix, then you can do the following:
chain multiple nodes like you did
use the Column Expression Node and create an extraction for each column (comment here: Knime depreciated this node but did so before making date, time and datetime functionalities available in their successor node)
If the columns change every so often, you are better of to
use a Column Splitter and split them by type
pipe the datetime columns into a Column List Loop Start
Extract the time, maybe rename the column
Loop End (Column Append)
Column Appender
Further, if you want the time as full time value instead of the hours only, you are better of using “Modify Date” node (set it to “Remove Date”). That node can process all columns at once.
If you dont need it as number value but are fine with Strings, you can even go as far as using the Date&Time to String node and simply set it to “HH”
I believe, an Unpivot followed by a Date Extract and then a Pivot should efficiently handle this. If you’re working with multiple date columns, this approach will be especially useful.
For your convenience, I’ve uploaded a sample dataset and the corresponding KNIME workflow. Hope this helps!