Trimming a String

1
Hello Experts,   I am getting a date as a string via a REST call. I need to trim the formatting to remove the +0000 at the end. What is the best approach to achieve this? Thank you  
asked
2 answers
2

If you just want the string, try something like:

replaceAll($yourStringVariable, '\+0000$', '')

or if you want to trim any time offset after the plus:

replaceAll($yourStringVariable, '\+\d{4}$', '')

or if you want to get a datetime variable out of the string, try parseDateTime or parseDateTimeUTC and then display however you want using formatDateTime

parseDateTime($yourStringVariable, 'EEE, d MMM yyyy HH:mm:ss Z')

answered
0

Hi Joe,

 

You can use the following string manipulation if it suits your requirements:

substring($Date, 0,findLast($Date, '+'))

 

This function with find the last ‘+’ in your string and then return the subtring before that.

 

You can read more about String functions here: String Function Calls | Mendix Documentation

 

Hope this helps.

answered