<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Time offset Issue in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273502#M50472</link>
    <description>&lt;P&gt;Sorry if my original post wasn't clear or confusing.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Here is a bit more detail:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I am printing the row to the screen using tLogRow (after reading from Snowflake). There is only one row since I am only picking the row with max date.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Now this row is printing the date as (along with rest of the row):&lt;/P&gt; 
&lt;P&gt;2019-03-13&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;In Snowflake the max date for this same row is:&lt;/P&gt; 
&lt;P&gt;2019-03-14&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;After the tLogRow I am using tAggregateRow and applying max function on the date column and only storing that date value in the output column. So now I only have to deal with this column value and not the row. After tAggregateRow, I have another tLogRow, which prints out this:&lt;/P&gt; 
&lt;P&gt;2019-03-13T20:00:00&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Let's call date above "a".&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Where is this timestamp coming from?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Here is the query that I ran in the Snowflake. It shows that actual date value along with three other timezones. It looks like that the value "a" matches with timezone Pago_pago.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="talendtime.PNG" style="width: 999px;"&gt;&lt;IMG src="https://yutwg22796.i.lithium.com/t5/image/serverpage/image-id/17447i8E7ED44475B9A3A9/image-size/large?v=1.0&amp;amp;px=999" title="talendtime.PNG" alt="talendtime.PNG" /&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The situation above brings to light following questions:&lt;/P&gt; 
&lt;P&gt;question 1: why is Talend taking a date that is march 14 but showing march 13.&lt;/P&gt; 
&lt;P&gt;question 2: where is the timestamp coming from in "a".&lt;/P&gt; 
&lt;P&gt;question 3: how do I fix this?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Mar 2019 13:00:29 GMT</pubDate>
    <dc:creator>talendstar</dc:creator>
    <dc:date>2019-03-20T13:00:29Z</dc:date>
    <item>
      <title>Time offset Issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273498#M50468</link>
      <description>&lt;P&gt;I have a Talend flow that read a single row of data, which contains the max date from the table in Snowflake.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am able to take that date and write it SQL Server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However the max date in Snowflake is not the same as what is being written to SQL Server table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Talend is applying an offset to date that it is reading from Snowflake.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I expect the date written to SQL Server as 03/14/2019. But what Talend write is&amp;nbsp;2019-03-13 20:00:00.000.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have found various solutions on the forum but all them seem not to work for me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any thoughts on how to resolve this issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 21:04:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273498#M50468</guid>
      <dc:creator>talendstar</dc:creator>
      <dc:date>2019-03-19T21:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: Time offset Issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273499#M50469</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;not very clear - what is your main error (problem)?&lt;/P&gt;&lt;P&gt;format or offset?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- format yyyy-MM-dd HH:mm:ss is default for MS SQL, and in any case internal date format is integer, so you must use formating function for change default date format in you SQL code or application&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- offset - need to check columns format (support timezone or not) and timezones&amp;nbsp; on all - Talend, Snowflake, SQL Server&lt;/P&gt;&lt;P&gt;offset mistakes is always pain&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; especially&amp;nbsp;because of some clients (an application which you use to visualize tables) - some of them automatically convert timezone to your local time and some not.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 21:17:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273499#M50469</guid>
      <dc:creator>vapukov</dc:creator>
      <dc:date>2019-03-19T21:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Time offset Issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273500#M50470</link>
      <description>&lt;P&gt;If you transfer the data with the Date typed column the job does not change anything!&lt;/P&gt;&lt;P&gt;Please describe how you measure the time offset. I pretty convinced it has something to do with the settings of the source and/or target database time zone or the way different tools interpret the date as text to present it to you.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 21:22:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273500#M50470</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-03-19T21:22:16Z</dc:date>
    </item>
    <item>
      <title>Re: Time offset Issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273501#M50471</link>
      <description>&lt;P&gt;Please take what you are telling. A date or timestamp column in a database does not have any format!&lt;/P&gt;
&lt;P&gt;The only topic where a pattern comes into the game is how the database interpret timestamps provided as text (e.g. in the SQL statement).&lt;/P&gt;
&lt;P&gt;Also the pattern in the Talend schema has absolutely no effect until you render the date as text (e.g. in a tLogRow) or your read a text file and expect to convert it into a Date.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2019 21:27:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273501#M50471</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-03-19T21:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Time offset Issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273502#M50472</link>
      <description>&lt;P&gt;Sorry if my original post wasn't clear or confusing.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Here is a bit more detail:&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I am printing the row to the screen using tLogRow (after reading from Snowflake). There is only one row since I am only picking the row with max date.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Now this row is printing the date as (along with rest of the row):&lt;/P&gt; 
&lt;P&gt;2019-03-13&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;In Snowflake the max date for this same row is:&lt;/P&gt; 
&lt;P&gt;2019-03-14&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;After the tLogRow I am using tAggregateRow and applying max function on the date column and only storing that date value in the output column. So now I only have to deal with this column value and not the row. After tAggregateRow, I have another tLogRow, which prints out this:&lt;/P&gt; 
&lt;P&gt;2019-03-13T20:00:00&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Let's call date above "a".&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Where is this timestamp coming from?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Here is the query that I ran in the Snowflake. It shows that actual date value along with three other timezones. It looks like that the value "a" matches with timezone Pago_pago.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="talendtime.PNG" style="width: 999px;"&gt;&lt;IMG src="https://yutwg22796.i.lithium.com/t5/image/serverpage/image-id/17447i8E7ED44475B9A3A9/image-size/large?v=1.0&amp;amp;px=999" title="talendtime.PNG" alt="talendtime.PNG" /&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;The situation above brings to light following questions:&lt;/P&gt; 
&lt;P&gt;question 1: why is Talend taking a date that is march 14 but showing march 13.&lt;/P&gt; 
&lt;P&gt;question 2: where is the timestamp coming from in "a".&lt;/P&gt; 
&lt;P&gt;question 3: how do I fix this?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 13:00:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273502#M50472</guid>
      <dc:creator>talendstar</dc:creator>
      <dc:date>2019-03-20T13:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: Time offset Issue</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273503#M50473</link>
      <description>&lt;P&gt;I was able to get this to work by using the workaround in following post:&lt;/P&gt; 
&lt;P&gt;&lt;A href="https://community.talend.com/t5/Design-and-Development/resolved-Convert-Historical-UTC-Time-in-Local-Time-with-Daylight/m-p/111753" target="_blank"&gt;https://community.talend.com/t5/Design-and-Development/resolved-Convert-Historical-UTC-Time-in-Local-Time-with-Daylight/m-p/111753&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I used this piece code to convert time to UTC and was able to get the correct date:&lt;/P&gt; 
&lt;PRE&gt;// template routine Java
package routines;
import java.util.Date;
public class UserDefined {
	static java.util.Calendar cal = java.util.Calendar.getInstance();
	static int zoneOffset = cal.get(java.util.Calendar.ZONE_OFFSET);
	static int dstOffset = cal.get(java.util.Calendar.DST_OFFSET);
    /**
     * convertUTCtoLocalTime: converts a UTC time given to local time
     * 
     * 
     * {talendTypes} Date
     * 
     * {Category} User Defined
     * 
     * {param} date type: The date to convert
     * 
     * {example} convertUTCtoLocalTime(sysdate) # returns date converted to local time
     */
	public static Date convertUTCtoLocalTime(Date date) {
		cal.setTime(date);
		cal.add(java.util.Calendar.MILLISECOND, (zoneOffset + dstOffset));
		return cal.getTime();
	}
	
    /**
     * convertLocalTimetoUTC: converts a local time given to UTC time
     * 
     * 
     * {talendTypes} Date
     * 
     * {Category} User Defined
     * 
     * {param} date type: The date to convert
     * 
     * {example} convertLocalTimetoUTC(sysdate) # returns date converted to local time.
     */
	public static Date convertLocalTimetoUTC(Date date) {
		cal.setTime(date);
		cal.add(java.util.Calendar.MILLISECOND, -(zoneOffset + dstOffset));
		return cal.getTime();
	}
}&lt;/PRE&gt; 
&lt;P&gt;Once you save code above in your repository&amp;gt;code (by creating a new routine) you can reference it (like you would reference Talend.parseDate).&lt;/P&gt;</description>
      <pubDate>Wed, 20 Mar 2019 17:12:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Time-offset-Issue/m-p/2273503#M50473</guid>
      <dc:creator>talendstar</dc:creator>
      <dc:date>2019-03-20T17:12:40Z</dc:date>
    </item>
  </channel>
</rss>

