String to Date and Time

Looking to turn a string into a date and time. I am aware of the String to Date Node, but for some reason, the node won’t recognize the columns with the date in this format - 20151016- as a string and won’t let me convert it into the date format I want (e.g., 10/16/2015).

Any idea why this is? Am I not using the correct node?

Thanks,
Matt

To convert in date use format yyyyMMdd.

My dates are already in that format, I need them to be converted other formats but I can not get the node to recognize the column that currently hosts the yyyyMMdd string that is my date. As in it does not list it as an option to convert it over.

Type it in. KNIME nodes do not provide you final format unless you use reporter. You can do it later in Excel.

Copy that. Thanks!

Is it possible that whatever reader node you’re using is interpreting the input as an integer, and not a string? In this case, the String to Date & Time node wouldn’t pick it up for conversion.

Maybe you could post a short workflow with a dummy example?

Hi, Scott

That’s exactly what it ended up being, so i converted to the column to a string. Oddly enough, I still could not get the node to work as it would not recognize certain strings as a convertible date. For example, 20150310

Attached is a work flow, with the data I seek to convert along with the error message I am getting.

Thanks in advance for any help!!

Use yyyyMMdd in a date format as I mentioned earlier.

As @izaychik63 mentions above, your date format is slightly off - don’t include the periods and reorder the fields. See attached example workflow.

StringDateExample.knwf (6.5 KB)

1 Like

@izaychik63, was slightly unsure what you meant. Now it is working. Thanks, @ScottF