Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

Seven Stars

Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

How can i convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd" ?


Accepted Solutions
Eleven Stars

Re: Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

in a tmap.
you canuse TalendDate.formatDate("yyyyMMdd",yourDate)
regards

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Eleven Stars

Re: Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

TalendDate.formatDate("yyyyMMdd",TalendDate.parseDate("dd MM yyyy", your string)) but you have to replace Jun to 6 and so on for month, and formating a bit this string.
does it come from a db?

Francois Denis

Tag as "solved" for others! Kudos to thanks!


All Replies
Eleven Stars

Re: Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

in a tmap.
you canuse TalendDate.formatDate("yyyyMMdd",yourDate)
regards

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Seven Stars

Re: Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

@fdenis Error of unparseble date occured

 

Eleven Stars

Re: Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

TalendDate.formatDate("yyyyMMdd",TalendDate.parseDate("dd MM yyyy", your string)) but you have to replace Jun to 6 and so on for month, and formating a bit this string.
does it come from a db?

Francois Denis

Tag as "solved" for others! Kudos to thanks!

Seven Stars

Re: Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

@fdenis Solved 

Seven Stars

Re: Convert this string "Tue, 26 Jun 2018 15:02:48 +0530" into Date having format "yyyyMMdd"

@fdenis

 

i am getting this type of error by using the solution

Exception in component tFileInputMail_1 (FetchFromGmail)
java.lang.RuntimeException: Unparseable date: "Wed, 20 Jun 2018 09:00:20 -0500"
at routines.system.ParserUtils.parseTo_Date(ParserUtils.java:321)
at delwarejob.fetchfromgmail_0_1.FetchFromGmail.tPOP_1Process(FetchFromGmail.java:1815)
at delwarejob.fetchfromgmail_0_1.FetchFromGmail.runJobInTOS(FetchFromGmail.java:2757)
at delwarejob.fetchfromgmail_0_1.FetchFromGmail.main(FetchFromGmail.java:2379)

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download