String to date format: 21MAR2025

Hi @versatilka and welcome to the Knime Community.

The format MMM for month supports the format of Jan, Feb, Mar, etc for month, which is basically the capitalized version of what you have (MAR vs Mar). So you can just capitalize the month via the String Manipulation like this:
join(substr($column1$, 0, 2), capitalize(substr($column1$, 2, 3)), substr($column1$, 5))

This should give you 21Mar2025

You can now use the String to Date&Time node to transform this into a date type using the Date format ddMMMyyyy

Something like this would work:
image

String Manipulation:

String to Date&Time:

EDIT: Sorry, forgot to attach the workflow. Also, the example that you gave (21) does not show if the day is a 2 digits representation or single (01 vs 1, 02 vs 2, etc), so I modified the String Manipulation to take care of this like this:
join(substr(padLeft($column1$, 9, "0"), 0, 2), capitalize(substr(padLeft($column1$, 9, "0"), 2, 3)), substr(padLeft($column1$, 9, "0"), 5))

Now it does not matter what representation the day is. It works for both. For example:
image

Results:
image

Here is the workflow, with the modified expression: String to date&time month name to format MMM.knwf (11.8 KB)

4 Likes