Nine Stars

[resolved] TalendDate.parseDate is adding 1 extra hour on DST start times

I think when you attempt to convert a string date timestamp using TalendDate.parseDate 1 extra hour is being added to DST start times.
The conversion works correctly for DST end times.
My job looks like:
tFileInputExcel > tMap > LogRow
On tFileInputExcel column DST_START is a String data type.
On tMap column DST_START is Date.
TalendDate.parseDate("yyyy-MM-dd HH:mm:ss",row1.DST_START)
In my Excel I put the following:
DST_START
2000-04-02 02:00:00
2001-04-01 02:00:00
2002-04-07 02:00:00
2003-04-06 02:00:00
2004-04-04 02:00:00
2005-04-03 02:00:00
2006-04-02 02:00:00
2007-03-11 02:00:00
2008-03-09 02:00:00
2009-03-08 02:00:00
2010-03-14 02:00:00
2011-03-13 02:00:00
2012-03-11 02:00:00
2013-03-10 02:00:00
2014-03-09 02:00:00
2015-03-08 02:00:00

I opened a bug:
https://jira.talendforge.org/browse/TDI-30367
1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: [resolved] TalendDate.parseDate is adding 1 extra hour on DST start times

Hi talendtester

Our developers are working on this issue, he suggests two solutions:
Solution 1?
Add two tJava components:
tJava_1 ---onsubjobok--->---onsubjobok--->tJava_2
tJava_1 add java code:
globalMap.put("defaultTimeZone", java.util.TimeZone.getDefault().clone());
java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("UTC"));

tJava_1(Set back the default timezone as before our last modification)
//Set back
java.util.TimeZone.setDefault((java.util.TimeZone)globalMap.get("defaultTimeZone"));

Solution 2?
Click "Run Job"> Advanced setting> check "Use specific JVM arguments"> then Add a JVM argument:
-Duser.timezone=UTC
Please let us know if it could fix your problem?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
4 REPLIES
Community Manager

Re: [resolved] TalendDate.parseDate is adding 1 extra hour on DST start times

Hi talendtester

Our developers are working on this issue, he suggests two solutions:
Solution 1?
Add two tJava components:
tJava_1 ---onsubjobok--->---onsubjobok--->tJava_2
tJava_1 add java code:
globalMap.put("defaultTimeZone", java.util.TimeZone.getDefault().clone());
java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("UTC"));

tJava_1(Set back the default timezone as before our last modification)
//Set back
java.util.TimeZone.setDefault((java.util.TimeZone)globalMap.get("defaultTimeZone"));

Solution 2?
Click "Run Job"> Advanced setting> check "Use specific JVM arguments"> then Add a JVM argument:
-Duser.timezone=UTC
Please let us know if it could fix your problem?
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Nine Stars

Re: [resolved] TalendDate.parseDate is adding 1 extra hour on DST start times

Both work succesfully. Solution 2 seems to be the least amount of work.
In future versions, is selecting the time zone going to be a preferences option?
Community Manager

Re: [resolved] TalendDate.parseDate is adding 1 extra hour on DST start times

Yes, we have created a jira issue for this request.
https://jira.talendforge.org/browse/TDI-30556
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] TalendDate.parseDate is adding 1 extra hour on DST start times

Hi Team,
This issue still persists, please let me know if any work around is available. I tried both the above mentioned workaround but no luck.
Thanks and Regards
Sanket