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

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) 


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!


All 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.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.