<?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: Date as context parameter type in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238928#M26883</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;If you are doing date operations (like comparing two dates), then you do not have to worry about the format. But if you are using this value for String operations (like print the value in specified format), then you will have to convert the value to desired format of your choice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt;
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2019 21:48:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-07-22T21:48:22Z</dc:date>
    <item>
      <title>Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238925#M26880</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;I want to get date as my context parameter, but when I do this, it changes it's format. e.g. my date is 07-17-2019, it changes this to Jul 17, 2019. May be this is because context date type doesn't have format in context parameter, can someone suggest how to achieve this. For the time, I am having all parameters in string&amp;nbsp; and later casting it to date.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 13:35:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238925#M26880</guid>
      <dc:creator>mani1304</dc:creator>
      <dc:date>2019-07-19T13:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238926#M26881</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; Since the context variable is date, it will retain the date value in it even though it changes format. So you will be able to safely use it for any date related operations like comparison.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; Now, if you want to print the date data of a context variable to a specific format, then you will have to convert them to string and use it accordingly.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt; 
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 15:27:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238926#M26881</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-22T15:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238927#M26882</link>
      <description>If I am getting it correctly, to print context parameter, it should be 
&lt;BR /&gt;string only or I am missing something. 
&lt;BR /&gt;E.g. I want to calculate start_date in prejob and later want to use it 
&lt;BR /&gt;several times, then first I have to convert it to string then cast it to 
&lt;BR /&gt;date because print can only be done in string ? 
&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Jul 2019 20:59:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238927#M26882</guid>
      <dc:creator>mani1304</dc:creator>
      <dc:date>2019-07-22T20:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238928#M26883</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;If you are doing date operations (like comparing two dates), then you do not have to worry about the format. But if you are using this value for String operations (like print the value in specified format), then you will have to convert the value to desired format of your choice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt;
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 21:48:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238928#M26883</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-22T21:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238929#M26884</link>
      <description>Means date can't be retain in it's derived form in date context parameter. Can we expect any improvement on this, so we needn't to take date as string ?
&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:35:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238929#M26884</guid>
      <dc:creator>mani1304</dc:creator>
      <dc:date>2019-07-24T15:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238930#M26885</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Please add the feature request using&amp;nbsp;&lt;A href="https://jira.talendforge.org/" target="_blank" rel="nofollow noopener noreferrer"&gt;https://jira.talendforge.org.&lt;/A&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Warm Regards,&lt;BR /&gt;Nikhil Thampi&lt;/P&gt; 
&lt;P&gt;Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 15:48:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238930#M26885</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-24T15:48:15Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238931#M26886</link>
      <description>&lt;P&gt;When you say "&lt;SPAN&gt;it changes this to Jul 17, 2019", you mean for example if you print it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In that case, you can force the format when printing the value :&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;System.out.println(TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", context.myDate))&lt;/PRE&gt;&lt;P&gt;Please see &lt;A href="https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html" target="_self" rel="nofollow noopener noreferrer"&gt;SimpleDateFormat&lt;/A&gt; for details on the pattern.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:03:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238931#M26886</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-07-24T16:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238932#M26887</link>
      <description>Yes, I don't want to convert it to string and then print.&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Jul 2019 16:56:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238932#M26887</guid>
      <dc:creator>mani1304</dc:creator>
      <dc:date>2019-07-24T16:56:41Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238933#M26888</link>
      <description>&lt;P&gt;I'm sorry but I don't get it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's say you have a context variable myDate which is of a Date type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to print it:&lt;/P&gt;
&lt;PRE&gt;System.out.println(TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", context.myDate))&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to do calculation on it, use it directly:&lt;/P&gt;
&lt;PRE&gt;Date newDate = TalendDate.addDate(context.myDate, "12", "dd")&lt;/PRE&gt;
&lt;P&gt;This will add 12 days to your date and return a new Date object&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to insert it in a Date/Timestamp/whatever database column, you can use it directly in a tMap for example&lt;/P&gt;
&lt;P&gt;If you want to insert it in a String database column, you will have to use TalendDate.formatDate() as well in your tMap&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to print it in a file, use it directly and choose a date format in the Talend schema definition&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please tell us exactly what you are trying to do because I really don't understand where the problem is?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jul 2019 17:28:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238933#M26888</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-07-24T17:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238934#M26889</link>
      <description>&lt;P&gt;What I want is like to print the date value, not after converting it to string then print.&lt;/P&gt;
&lt;PRE&gt;System.out.println(context.myDate))&lt;/PRE&gt;
&lt;P&gt;The reason for this is, let's take your example where 12 days are added in date and suppose I want to take this in my filename, e.g. test_context.parmdate.txt and here it changes it's format and I want to avoid this.&lt;/P&gt;
&lt;P&gt;Hope this explains my concern.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 08:01:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238934#M26889</guid>
      <dc:creator>mani1304</dc:creator>
      <dc:date>2019-07-25T08:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238935#M26890</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;you cannot have a Date in a context variable a print it as a String without converting it to a String first.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;This conversion can either be done explicitly (manually) with the TalendDate.formatDate() method in which you can specify a format.&lt;/P&gt; 
&lt;P&gt;Or the conversion can be done implicitly where you will not be able to control the format. This is what happen when you use stuff like:&lt;/P&gt; 
&lt;PRE&gt;System.out.println(context.myDate);
//or
String filename="myFilename_" + context.myDate + ".txt";&lt;/PRE&gt; 
&lt;P&gt;The correct way to do what you want is to use a Date in the context variable and explicitly (manually) convert it whenever you want to use it in a String (be it a filename or a log or whatever).&lt;/P&gt; 
&lt;PRE&gt;System.out.println(TalendDate.formatDate("yyyy-MM-dd HH:mm:ss", context.myDate));
//or
String filename="myFilename_" + TalendDate.formatDate("yyyyMMdd'T'HHmmss", context.myDate) + ".txt";&lt;/PRE&gt; 
&lt;P&gt;If you have to change the date, I would also recommand to use a global variable to store the modified date and work on it:&lt;/P&gt; 
&lt;PRE&gt;globalMap.put("myWrkDate", context.myDate);
//add 12 days
globalMap.put("myWrkDate", TalendDate.addDate((Date)globalMap.get("myWrkDate"), 12, "dd"));
//use this variable in a filename
String filename="text_" + TalendDate.formatDate("yyyyMMdd'T'HHmmss", (Date)globalMap.get("myWrkDate")) + ".txt";&lt;/PRE&gt; 
&lt;P&gt;Of course, those are simple examples you'll have to adapt to your needs and jobs.&lt;/P&gt; 
&lt;P&gt;You can also create a routine if you really have to use this in a lot of places.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jul 2019 08:28:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238935#M26890</guid>
      <dc:creator>lennelei</dc:creator>
      <dc:date>2019-07-25T08:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Date as context parameter type</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238936#M26891</link>
      <description>Thanks buddy, I got it that it can't be done in Talend and that was my&lt;BR /&gt;initial question.&lt;BR /&gt;I appreciate your help.&lt;BR /&gt;</description>
      <pubDate>Thu, 25 Jul 2019 10:25:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Date-as-context-parameter-type/m-p/2238936#M26891</guid>
      <dc:creator>mani1304</dc:creator>
      <dc:date>2019-07-25T10:25:41Z</dc:date>
    </item>
  </channel>
</rss>

