Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert a string to another string in tmap - from "Fri Jun 07 00:00:00 CEST 2019" to 2019-06-07

Hi everyone,

 

I need to convert the following string Fri Jun 07 00:00:00 CEST 2019 to another string but with the format 2019-06-07 (yyyy-MM-dd)

 

Can anyone help, please? I have been trying everything but I can't find a solution!


Thank you in advance 0683p000009MACn.png 

Labels (2)
3 Replies
Anonymous
Not applicable
Author

        SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzz yyyy");
        Date d = sdf.parse("Fri Jun 07 00:00:00 CEST 2019");
        sdf.applyPattern("yyyy-MM-dd");
        String newDateString = sdf.format(d); //2019-06-07

may be worth putting into a tJavaRow beforehand rather than running all this through a tMap

Anonymous
Not applicable
Author

Thank you very much! It worked for me : )

Anonymous
Not applicable
Author

@Gerard_BA 

 

Another option is to convert using Talend date parsing functions available in tMap as shown in below link.

 

https://community.talend.com/t5/Design-and-Development/Convert-format-EEE-MMM-dd-HH-mm-ss-Z-yyyy-to-...

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved