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: 
WWong1683187644
Contributor III
Contributor III

Time difference issue in Talend

Hi,

I am using talend to extract data from database, then export to csv.

But i notice the time value output to csv is wrong, it is not the original time value in database.

I suspect could be due to database server and talent server's time zone is different, so causing this problem, am i right?

May i know how can i get the original time value instead of the converted time?

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi

Check the time zone of Database server, then add this line of Java code on a tJava component in the beginning of job to change the default timezone.

for example:

java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("America/Los_Angeles"));

 

Regards

Shong

View solution in original post

6 Replies
Anonymous
Not applicable

Hello,

 

Please try to do an experiment first.

 

Database usually can convert Date to String. Use a format that exposes the TIME ZONE as well.

Talend tLogRow can also respect such date patterns.

 

I have written an article about this you can find it here: https://community.talend.com/s/article/Talend-Data-Types-explained

Anonymous
Not applicable

Hi

Check the time zone of Database server, then add this line of Java code on a tJava component in the beginning of job to change the default timezone.

for example:

java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("America/Los_Angeles"));

 

Regards

Shong

Samuel_Bennett
Contributor
Contributor

  1. Check the time zone settings: Verify the time zone settings of both the database server and the Talend server. Ensure that they are configured correctly and set to the same time zone or adjust them accordingly to align with your desired output.
  2. Adjust the time zone in Talend: In your Talend job, you can explicitly specify the time zone to be used for extracting the data from the database. You can do this by setting the time zone context variable or using a specific component or function in Talend that allows you to manipulate time zones. This way, you can ensure that the data is extracted in the desired time zone. UPSers
  3. Convert the time zone in Talend: If you want the time values to be converted to a specific time zone during the extraction process, you can use Talend's built-in functions or components to perform the necessary time zone conversion. This will ensure that the time values in the CSV file reflect the desired time zone.

 

anselmopeixoto
Partner - Creator III
Partner - Creator III

Hi,

 

Just trying to help with another suggestion that I found useful in some situations, you could set JVM argument or system property user.timezone to match database timezone:

 

JVM argument examples (you can set it in Run/Advaced settings/JVM Setting):

 

-Duser.timezone=UTC

-Duser.timezone=America/Sao_Paulo

 

System property (you can use a tJava for this option):

 

System.setProperty("user.timezone", "UTC");

 

 

 

WWong1683187644
Contributor III
Contributor III
Author

looks like i don't have permission to visit the article you shared or the link broken.. 😂

Anonymous
Not applicable

I reached out to the respective team to publish it.