Hi
I am trying to update a date field using TalendDate.getCurrentDate() function in tMap but this one updates the field with local time zone. Is there a way to update the field in GMT?
Thanks
Kalyan
The java Date object has non timezone. It is always UTC based. The timezone is actually only relevant if you want to render a date.
If you have a Date and you need to move it into GMT you have to know the necessary bias.
Use the function TalendDate.addDate:
Hi kalyan,
Try this expression
TalendDate.parseDate("dd MMM yyyy HH:mm:ss",TalendDate.getCurrentDate().toGMTString()) and let me know it's working for you or not.
I am not sure if the toGMTString method always returns the same format and it actually does not solve the problem because the parser depends also from the local timezone of the job server. I would not recommend that!
By far better is if you know which is the original timezone of the given date and move it with the correct bias.
I tried the option of
TalendDate.parseDate("dd MMM yyyy HH:mm:ss",TalendDate.getCurrentDate().toGMTString())
This works fine on output object if the action on data is set to Insert. But the same thing fails to load the date time in GMT if the action on data is set to Insert or update.
Any ideas?
Ok guys, it works fine? This method is deprecated! Oracle can remove this without any notification in the next Java release.
This is a quick and dirty solution and by far not professional.
Hi
Attached screenshot#1 has my job.
There are 2 if conditions.
Action on data is set to Insert only on final output (S_BU) object with If Condition 1.
Action on data is set to Insert or Update on final output (S_BU) object with If Condition 2.
If Condition 1 is true then date is getting stored correctly in GMT. But if 2nd condition is true then the 2 fields are getting stored in my local date time.
Why is such an odd behavior?
Thanks
Kalyan