Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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
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
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
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");
looks like i don't have permission to visit the article you shared or the link broken.. 😂
I reached out to the respective team to publish it.