Convert date column to Time hh:mm:ss

Hi there,
I have Date column and i want to break that complete date to only Time(HH:MM:SS) or (HH:MM), i have tried this using String to Date&Time, it didnt work. I have tried using Extract date&Time fields, but it is not giving me the expected solution.
I dont want to extract the hours or minutes columns separately instead i want date column to be replaced with hh:mm directly.Please help

Example:
Time.xlsx (8.5 KB)

Thanks

Hi,

I recommend using a String to Date&Time node in combination with a Modify Date node.

  1. String to Date&Time node
    With the String to Date&Time node you can transform your string into the KNIME Date&Time format, including the date and time information
  2. Modify Date node
    With the Modify Date node you can then remove the date information from the Date&Time column.

I hope this helps you already. If you need further help with the configuration of these node please let me know :slight_smile:

Cheers,
Kathrin

Hi Kathrin,
Thanks for the help!!
It helped me in removing the date, But what, if i only want to keep minutes and seconds or only hours and minutes?

Hi,

I’m not aware of a single node that can do this for you.

What you could do is to use:
1.) an Extract Date&Time Fields node to extract the information you are interested in, e.g. hours and minutes.
2.) a String Manipulation node to join the hours and minutes into one cell
3.) a String to Date&Time node to create a time cell with only the hour and minute information

Cheers,
Kathrin

1 Like

Could you please help me with workflow? It would be helpful for me.

Thanks!!

Attached a small example workflow :slight_smile:

DateTime_Example.knwf (10.9 KB)

1 Like

Hi Kathrin,
For Minutes and Seconds, i have used m:s and mm:ss but its not working. please help me with just the format of it. Also, if only want to see the minutes only, what should i use in String manipulation. I know i am asking alot of questions, ia m new to KNIME, sorry for that!!

Thank you so much :blush:

Hi,

I just tried as well and a time needs the hour information. So only minutes and seconds doesn’t work as time. You could use the duration format for this.

If you tell me a bit more about what you are trying to achieve I’m happy to give you some recommendations :slight_smile:

Cheers,
Kathrin

Hi,
Plotting a line Graph using Time column is not making a readable line graph since multiple executions are present in same time period in my table but the minutes and seconds are bit vary. So, I am trying to plot the Line Graph using only minutes and seconds on x-axis to make it more understandable.

please suggest

Hi,

sorry, I think I didn’t understand your goal yet.

Is your data all within one hour? Otherwise values at 1:30:59pm would be plotter right next to the values for 5:31:02pm for example. (I used here the forma h:m:s) Or did I understand something wrong?

Cheers,
Kathrin

Hi,
so, here is my line plot which is messy in visualisation perspective as data executions are more in it during same time(hours), hence i would like to plot it using only minutes(m) or minutes along with seconds(m:s).
Please let me know if you need more details on it.
Attached plot here: