Replace or remove a portion of string with a regex

Hi @andrea_ramirez,

Welcome to the community. I know that this thread was about String Manipulation, but given its age, it probably would be best in future to open a new question, whilst maybe referring to the old post if you consider it heavily related.

Re your specific question, whilst you can do this with string manipulation, in general converting string data from one date/time format to another, such is what you are doing here, the safest option which doesn’t require any coding is to convert the string to date and time using the String to Date&time node, specifying the format of your existing data, and then convert back from date/time to string using the Date&time to String node specifying the required new format.

So here you would convert to Datetime using a format such as:

d/M/yy h:mm a

(note the case of the letters used here as this is important to their meaning)

and then convert back to String using the format:

d/M/yy

One caveat and slight complication here is that the accepted capitalisation of the AM/PM has changed (possibly locale dependant) with the latest versions of java, and therefore can trip you up. For further info if this causes you problems, see this thread…

7 Likes