Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
dattasud
Contributor III
Contributor III

Incorrect TimeZone error in Salesforce-Talend integration, how to correct timezone?

Hi All,

I am using Talend Big Data 7.3 version.

I have data coming from Salesforce. The data includes one column - AppointmentDate. After I retrieve the data in the talend job, its printing the date in UTC time format. I checked the Salesforce user account confirguration and its set to EDT timezone. So, when I see the same data in Salesforce report its in EDT timezone. But that same date in talend job, its showing UTC time.

So, I wrote a method to convert the UTC to EDT timezone. I wrote a routine method and called it on the column using a tmap. But when I print the input date from Salesforce in my method, its showing EDT timezone.

Below is the method I wrote:

public synchronized static String formatDateUTCtoEST(java.util.Date dateVal) {
    	if(dateVal != null) {
    	System.out.println("Actual Date: "+dateVal);
        
    	  DateFormat estFormat = new SimpleDateFormat();
    	  DateFormat gmtFormat = new SimpleDateFormat();
    	  TimeZone gmtTime = TimeZone.getTimeZone("GMT");
    	  TimeZone estTime = TimeZone.getTimeZone("EST");
    	  estFormat.setTimeZone(gmtTime);
    	  gmtFormat.setTimeZone(estTime);
    	  System.out.println("GMT Time: " + estFormat.format(dateVal));
    	  System.out.println("EST Time: " + gmtFormat.format(dateVal));
    	  return gmtFormat.format(dateVal);
    	}  
    	return "No Appointment Set";
    }

The output I am getting:

Actual Date: Mon Jun 08 13:00:00 EDT 2020
GMT Time: 6/8/20 5:00 PM
EST Time: 6/8/20 12:00 PM

But, In Salesforce report the Appointment Date is 6/8/2020 9:00 AM.

Also, when I print the date in my method first, its showing EDT, which is actually UTC. And if I convert in my method then its taking the time in EDT and doing incorrect calculations.

Please help, how can I correct the timezone in my appointment date field. 

 

Labels (4)
0 Replies