Date Format Transfer

My date columns show dd/mm/yy and I would like to transfer to yyyy-mm-dd.
I tired nodes String to Date & Time but there is no format to distinguish dd/mm/yy.

Hi @LanceHsu ,

It’s not obvious on the dialog, but you can actually just overtype the value in the dropdown field with any format you require.

So to change from your current format to required format, you can use a String to Date&Time specifying the format you need, which in your case I would probably recommend d/M/yy

Note I’ve used upper case M (as lower-case “m” would mean “minutes”), and also only a single d and single M, explained below this sample image

You could specify dd/MM/yy but the reason I wouldn’t do that is that it is much stricter requiring two-digit days and months in all cases.

However if you specify only d/M/yy, it can handle both single and two digit days and months:

e.g.
image

This may be all you require, but also, please note that once it is a date, although it is apparently in the format you are looking for, this is only how KNIME renders it as Date datatypes have no actual format. Depending on what you want to do with it (e.g. output to a file), to output in a specific format (even yyyy-MM-dd), you are often best doing a conversion back to string just before you produce your output, in which case you would use the Date&Time to String, specifying yyyy-MM-dd as your required format)

5 Likes

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