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

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

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

All 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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now