[Bug] Date and Time to String fails

Hi,

while working on an approach to efficiently and quickly, regardless of the size of a data set, inject column types, I converted sample data to strings.

While doing so I happen to notice the Date&Time to String – KNIME Hub Node seems to struggle to convert the Column Type “Date and Time” to a string as the column is not recognized as a valid input type.

In addition, the https://hub.knime.com/knime/extensions/org.knime.features.expressions/latest/org.knime.expressions.base.node.formulas.FormulasNodeFactory Node fails with the error

Errors overwriting node settings with flow variables: Unknown variable "currentColumnName"

Here is the workflow showing the issue:

Best
Mike

It seems you try to apply the same date and time pattern to all date and time columns at once. This surely will not work.

You will have to provide a correct pattern for each of them. The guess function will help.

https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html

1 Like

Not quite. The Date&Time to String – KNIME Hub Node does not accept any input schema like a date time stamp with time zone offset. It merely converts any given Date/Time format into a string,

1 Like

Hello @mwiegand,

it’s always been a bit challenging to understand what exactly is troubling you and where is that bug you are talking about :smiley:

Date and time column you are referring to and unable to convert is legacy date and time column type (as opposed to Local Date, Local Time, Local Date Time, Zoned Date Time column types) and to work with it you should use legacy Date&Time nodes. In this case Time to String (legacy) node can convert it to string column or you should use Legacy Date&Time to Date&Time node to make sure you don’t have any legacy types. (In general if there is no strong reason for it you should avoid using legacy Date&Time column types.)

In addition Column Expressions node fails as it’s configured with a flow variable that is not available to him. (Error message clearly states that: Unknown variable “currentColumnName”). That is probably the case cause you have done copy paste of above Column Expressions node which is part of Column List Loop and there node was configured to use mentioned flow variable.

And one more thing. Don’t think you should start topics with [Bug] as not every time you configure something wrong means there is a bug in a software.

Br,
Ivan

1 Like

Ahh, legacy data types. Than it’s more a feature than a bug :wink:

Wouldn’t it be a nice option for the Test Data Generator – KNIME Hub Node to explicitly include legacy data types to prevent unnecessary confusion?

1 Like

Don’t think so :sweat_smile:
Knowing how to recognize column types leaves out confusion and adding one node solves you issue. And not to mention there are many other nodes that are more used (I personally never used this node) and are missing these kind of “nice options”.
Ivan