Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Lord-Vader
Contributor III
Contributor III

Simple DATE to UNIX TIME Convertion Help Needed.

Hello Fellow community.

I'm getting data from a table and in a tMap i'm trying to convert the DATE(

2020-01-28 00:00:00

) to UNIX(

1686200924

) and return it as integer.

I can't find anything online, only libraries to import in the tJava, but i dont want that.

If any one know how to do this in the tMap variable expression would be great.

Thnx for any help.

Vader Out 💪.

Labels (2)
1 Solution

Accepted Solutions
anselmopeixoto
Partner - Creator III
Partner - Creator III

Hi @kevin cork​ 

 

After you extract the date from a table using a Date data type, try the following code on tMap:

 

row1.date_column.getTime() / 1000

 

However, I believe the return would be in long data type. Not an integer.

View solution in original post

3 Replies
anselmopeixoto
Partner - Creator III
Partner - Creator III

Hi @kevin cork​ 

 

After you extract the date from a table using a Date data type, try the following code on tMap:

 

row1.date_column.getTime() / 1000

 

However, I believe the return would be in long data type. Not an integer.

Anonymous
Not applicable

Hello,

The data outputed can be read with double, float or long type.

Here is an example of reverse about converting a UNIX timestamp to a readable date.

https://help.talend.com/r/en-US/8.0/tmap/tmap-tlogrow-tfileinputdelimited-tfileinputdelimited-conver...

Best regards

Sabrina

Lord-Vader
Contributor III
Contributor III
Author

Thank you very much. This helped a lot.

Vader Out 💪.