New archived content: Talend MDM, Talend Data Catalog 8.0, and Talend 7.3 products reached their end of life in 2024. Their documentation was moved to the Talend Archive page and will no longer receive content updates.
A Unix timestamp is a series of numbers non-human readable such as
13959.583,1330578363. This scenario shows how to convert it to a readable date or map it to
the target system format.
Converting a UNIX timestamp to a readable date
Procedure
Create a .txt file example of a UNIX timestamp with the following data:
13959.583
1356854
1330578363
Create a Job named ConvertUnixTime, composed of a
tFileInputdelimited, a tMap and a
tLogRow component linked by two
main rows.
Double-click tFileInputdelimited to open its
Component view and fill the File
name/Stream field with path of the .txt file you created for
example, "D:/file/in.txt".
Click the ellipsis button (...) to edit the schema of the
component and add a new column named unixDate.
Information noteNote: The data entered can be read with double, float, or long type.
Double-click tMap to configure it and place the
unixDate column of the input table to the output table.
Enter new java.util.Date((long)(row1.unixDate*1000))
into the expression box of the output table column.
Change the Type of the data to
Date in the Schema editor and
enter the following Date pattern: "dd-MM-yyyy
HH:mm:ss". The following schema should appear:
Execute the Job. The following results are output to the console: