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

issue related to datetime format

Hi ,

I am getting date value from  previous module as :  Mon Jan 28 09:58:53 IST 2019

but i need to convert this date in tjavaFlex like this ....2019-01-28 09:58:53...How to achieve this ..0683p000009M2Jw.png

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

    Please refer the snippet below. I have marked both input and output values as String but if needed, you can type cast it further based on your need.

0683p000009M211.png

 

0683p000009M2KB.png

 

The code snippet for conversion is as below.

TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",TalendDate.parseDate("E MMM dd HH:mm:ss z yyyy",row1.input_date)) 

Please spend a second to mark the topic as resolved. Kudos are also welcome 🙂

 

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 🙂

 

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Hi,

 

     You can use the Parse and format components of tMap to do the modification of date from one format to another.

 

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 🙂

David_Beaty
Specialist
Specialist

Hi,

 

I'd also suggest using the TalendDate.isDate() function as well in conjunction with TalendDate.parseDate, to ensure the date is always in the expected format.

Anonymous
Not applicable
Author

I tried with tmap but getting below error.

0683p000009M2K6.png

Anonymous
Not applicable
Author

Hi,

 

    Please refer the snippet below. I have marked both input and output values as String but if needed, you can type cast it further based on your need.

0683p000009M211.png

 

0683p000009M2KB.png

 

The code snippet for conversion is as below.

TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",TalendDate.parseDate("E MMM dd HH:mm:ss z yyyy",row1.input_date)) 

Please spend a second to mark the topic as resolved. Kudos are also welcome 🙂

 

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 🙂