user955732
user955732

Reputation: 1370

parse-dateTime() - illegal pattern character 'T'

Trying to parse a date string:

parse-dateTime('2015-07-10T17:58:25.290+08:00', "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")

but it fails with:

illegal pattern character 'T'

Why??

Thanks for any help!!

Upvotes: 2

Views: 5870

Answers (3)

Seb
Seb

Reputation: 684

it looks to melike you changed format and input parameters. parse-dateTime(,

The expression: parse-dateTime("yyyy-MM-dd'T'HH:mm:ss.SSSXXX",'2015-07-10T17:58:25.290+08:00') works fine on my Designer (TIBCO BW 5.12) without any errors.

Cheers Seb

Upvotes: 0

user955732
user955732

Reputation: 1370

Thanks Jigar Joshi, indeed its most likely a bug in tibco.

I solved it using the demo code you provided.

Thanks!!

ideone.com/Xn1yGt

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy-MM
dd'T'HH:mm:ss.SSSXXX", Locale.US);
System.out.println(dateFormat.parse("2015-07-10T17:58:25.290+08:00"));
}
}

Upvotes: 1

pr-shadoko
pr-shadoko

Reputation: 190

The function tries to interpret the character T which has no meaning. You have to escape it instead of surrounding it with quotes, so it will be considered as a meaningless character. So it should be :

parse-dateTime('2015-07-10T17:58:25.290+08:00', "yyyy-MM-dd\THH:mm:ss.SSSXXX")

Upvotes: 0

Related Questions