Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How to convert EST to IST with tjava component?
Input data:
03/10/2019
Output should be in below format:
"EEE, MMM dd HH:mm:ss 'EST' yyyy"
But receiving the output in IST format only. Appreciate your kind help.
Thanks.
Issue resolved with below codes:
String inptdate = input_row.Date;
SimpleDateFormat sdfgmt = new SimpleDateFormat("MM/dd/yyyy");
sdfgmt.setTimeZone(TimeZone.getTimeZone("IST"));
SimpleDateFormat sdfmad = new SimpleDateFormat("MM/dd/yyyy 'at' hh:mma z");
sdfmad.setTimeZone(TimeZone.getTimeZone("EST"));
Date date = sdfgmt.parse(inptdate);
output_row.Date = sdfmad.format(date);
String inptdate1 = input_row.Date;
SimpleDateFormat sdfgmt1 = new SimpleDateFormat("MM/dd/yyyy");
sdfgmt1.setTimeZone(TimeZone.getTimeZone("IST"));
SimpleDateFormat sdfmad1 = new SimpleDateFormat("dd MMMM yyyy zzzz");
sdfmad1.setTimeZone(TimeZone.getTimeZone("IST"));
Date date1 = sdfgmt1.parse(inptdate1);
output_row.Date1 = sdfmad1.format(date1);
String inptdate2 = input_row.Date;
SimpleDateFormat sdfgmt2 = new SimpleDateFormat("MM/dd/yyyy");
sdfgmt2.setTimeZone(TimeZone.getTimeZone("IST"));
SimpleDateFormat sdfmad2 = new SimpleDateFormat("EEE, MMM dd HH:mm:ss zzz yyyy");
sdfmad2.setTimeZone(TimeZone.getTimeZone("IST"));
Date date2 = sdfgmt2.parse(inptdate2);
output_row.Date2 = sdfmad2.format(date2);
Hi,
this is your question - https://stackoverflow.com/questions/54684583/how-to-fix-date-format-issue-in-talend/54687280?noredir...
?
as mentioned there, the same question here
do you want real conversion?
in this case all you dates will be converted to date + EST time
or you just want to use print the same date with 00:00:00 for time and just add EST?
if just print, you could set JVM timezone to EST
TalendDate.formatDate("EEE, MMM dd HH:mm:ss 'EST' yyyy",row1.strDate)
because your input does not contain the time, your output in proper EST will always have format like
Sun, Mar 10 13:30:00 EST 2019
but if you do not need time, do as above
Thank you for your reply!
via using the above statement..I get the output in the IST format with the hard coded value 'EST'. No worries I write a java code in tjavarow to convert the IST to EST format.
But now the issue is that - the output is not getting in the Column3. For the Column3 I have written a java code. Please find below:
SimpleDateFormat FORMATTER = new SimpleDateFormat("MM/dd/yyyy 'at' hh:mma z");
TimeZone istTimeZone = TimeZone.getTimeZone("Asia/Kolkata"); //Source timezone
TimeZone etTimeZone = TimeZone.getTimeZone("America/New_York"); //Target timezone
Calendar Date = Calendar.getInstance(etTimeZone);
FORMATTER.setTimeZone(etTimeZone);
System.out.println(FORMATTER.format(Date.getTime()));
Output should be like this: Please find attached screenshot.
Can you please help me to get the correct output in Column3. Thank you.
Issue resolved with below codes:
String inptdate = input_row.Date;
SimpleDateFormat sdfgmt = new SimpleDateFormat("MM/dd/yyyy");
sdfgmt.setTimeZone(TimeZone.getTimeZone("IST"));
SimpleDateFormat sdfmad = new SimpleDateFormat("MM/dd/yyyy 'at' hh:mma z");
sdfmad.setTimeZone(TimeZone.getTimeZone("EST"));
Date date = sdfgmt.parse(inptdate);
output_row.Date = sdfmad.format(date);
String inptdate1 = input_row.Date;
SimpleDateFormat sdfgmt1 = new SimpleDateFormat("MM/dd/yyyy");
sdfgmt1.setTimeZone(TimeZone.getTimeZone("IST"));
SimpleDateFormat sdfmad1 = new SimpleDateFormat("dd MMMM yyyy zzzz");
sdfmad1.setTimeZone(TimeZone.getTimeZone("IST"));
Date date1 = sdfgmt1.parse(inptdate1);
output_row.Date1 = sdfmad1.format(date1);
String inptdate2 = input_row.Date;
SimpleDateFormat sdfgmt2 = new SimpleDateFormat("MM/dd/yyyy");
sdfgmt2.setTimeZone(TimeZone.getTimeZone("IST"));
SimpleDateFormat sdfmad2 = new SimpleDateFormat("EEE, MMM dd HH:mm:ss zzz yyyy");
sdfmad2.setTimeZone(TimeZone.getTimeZone("IST"));
Date date2 = sdfgmt2.parse(inptdate2);
output_row.Date2 = sdfmad2.format(date2);
@pgajghate wrote:
Issue resolved with below codes:
Congratulations!
but this is not what was asking for 🙂
this is why I asked you about time difference, which you have in your final output
any time when expecting a proper answer - you must ask a proper question! 🙂
in any case - welcome!
P.S.
why did I think it is the same question?
because it uses the same answer 🙂