How to modify a string Date&Time with tricky formatting into either a Date&Time value or Integer value?

I am trying to build a linear regression model in KNIME to look at my local government’s data on crime statistics in our city. However, they have one really frustrating column that stores the date and time of a crime being committed with the format: MM.dd.yyyy HH:mm. For example it would read: 1/1/2023 0:00. I have spent the past two hours trying to find a way to convert this column from the string type to a Date&Time format or somehow, an integer format but have not been able to get the “String to Date&Time” node to work. I get the error: ERROR String to Date&Time 3:3 Execute failed: Failed to parse date in row ‘Row0’: Text ‘1/1/2017 0:00’ could not be parsed at index 0"

This confuses me. Your example doesn’t match your formatting description. Your formatting description shows a period separator and leading 0 for month, day and hour. It seems like your format is actually M/d/yyyy H:mm in your example.


@fischers97 if you put a fixed date value into a model you will not be able to use that model on future data. So you might want to think about what you want to do with this data. Maybe extract weekdays or something.

Wow, my late nighter must have really done some work on my brain… Can’t believe I missed that. Thanks for your help, that solved it.


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