You can parse dates that contain text, without having to replace or alter the text in any way.
The parse and format date expression have an option to literally use the text from the pattern. Simply place your text between two single quotes.
For example if I want to print the following text: My Date: 07/28/2015 My Time: 10:20
I would use the following expression: 'My Date:' MM/dd/yyyy 'My Time:' HH:mm
As you can see I used a single quote around the text that isn't part of my pattern and that will be placed directly in the date.
If you'd like to use this in a microflow expression you'd have to do something extra. The single quote starts and ends a string. So if you would use the single quote in the expression it wouldn't work. Because it would start and end the string multiple times.
You'll need to escape the single quote. In a Mendix microflow a single quote is escaped by putting another single quote in front of it: '' (these are 2 single quotes ', not a double qoute ").
So my microflow expression would be: (please note these are all single quotes)
parseDateTime( '''My Date:'' MM/dd/yyyy ''My Time:'' HH:mm', $MyDate)
And to parse your date with the T in it you'd use:
parseDateTime( 'YYYY-MM-DD''T''HH:mm:ss.SSSZ', $MyDate)
Fixed it with 2 string adjustments, first replace the T
replaceFirst($DateString, 'T', ' ')
Then replace the Z part
replaceAll($DateString, '(+\d\d:\d\d)', '+' + replaceFirst( substring($DateString, length($DateString) -5, 5), ':', ''))
And then I can parse it
parseDateTime($DateString, 'yyyy-MM-dd HH:mm:ss.SSSZ')
Its not beautiful or elegant but it works
Did you try 'YYYY-MM-DD''T''HH:mm:ss.SSSZ' thus escaping the single quote that would normally end the string?
I ran in to the same issue. I looked in to this with my collegue and found the following solution.
In Java 8 some things changed for the datetime.
This format worked for me:
then this worked:
Z is replaced with X in your example.