Four Stars

Convert to Date 2017-09-06T23:10:25Z

I'm receiving a date string in the following format but I can't find a way to convert it using parseDate.  I've tried a bunch of different format strings.

 

TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",Var.var1) 

1 ACCEPTED SOLUTION

Accepted Solutions
Six Stars

Re: Convert to Date 2017-09-06T23:10:25Z

Hi, 

 

Just realized you had an example in the subject of your message.

 

The following seems to work, I removed the milleseconds from the format ('SSS') as they are not in your example date.

 

System.out.println(TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss'Z'","2017-09-06T23:10:25Z"));

Result : Wed Sep 06 23:10:25 CEST 2017

 

 

Hope this helps!

4 REPLIES
Six Stars

Re: Convert to Date 2017-09-06T23:10:25Z

Hi,

 

Can you post some examples of date strings you're receiving? Then i'll give it a go here.

Where are you receiving them from?

 

Six Stars

Re: Convert to Date 2017-09-06T23:10:25Z

Hi, 

 

Just realized you had an example in the subject of your message.

 

The following seems to work, I removed the milleseconds from the format ('SSS') as they are not in your example date.

 

System.out.println(TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss'Z'","2017-09-06T23:10:25Z"));

Result : Wed Sep 06 23:10:25 CEST 2017

 

 

Hope this helps!

Six Stars

Re: Convert to Date 2017-09-06T23:10:25Z

Try this 

TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",Var.var1)

Four Stars

Re: Convert to Date 2017-09-06T23:10:25Z

That did it! thank you.