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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to convert Date Format into epoch time by using tMap?

Hi, I have an Input which is "1900-01-01T00:00:00" that is a String and I need to convert it into epoch time which is long. How can I achieve this?

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi,

 

    Please refer the below logic. 

0683p000009M9Ea.png

 

0683p000009M9KH.png

 

I cross verified the answer and it looks same as below.

0683p000009M9KW.png

 

The function used is as shown below.

(TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss",row1.input_date).getTime())/1000 

Please spare a second to mark the topic as resolved as it will help others during their reference 🙂

 

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

3 Replies
Anonymous
Not applicable
Author

Hi,

 

    Please refer the below logic. 

0683p000009M9Ea.png

 

0683p000009M9KH.png

 

I cross verified the answer and it looks same as below.

0683p000009M9KW.png

 

The function used is as shown below.

(TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss",row1.input_date).getTime())/1000 

Please spare a second to mark the topic as resolved as it will help others during their reference 🙂

 

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

Anonymous
Not applicable
Author

Hi Nikhil,

 

Thanks for your kind response and it helped to resolve the issue.

 

However, how to get the current local date into epoch time? What will be the function that I need to write in Expression Builder? Current Date Format would be ("yyyy-MM-dd"T"HH:mm:ss") that should be coverted into epoch time. 

 

I would really appreciate your kind support. Thanks!

 

Anonymous
Not applicable
Author

Hi,

 

    Since current time is already in date format, could you please try below?

 

(TalendDate.getCurrentDate().getTime())/1000 

 

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