Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, Hope everyone is safe and sound.
I need to read a String from DB (which is actually a date) and parse it as a date and use it further in my code.
<pre>
String tdate = "2020-08-14T08:59:34.961+05:30";
System.out.println("Date from DB: " + tdate);
Date tempDate = TalendDate.parseDate("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", tdate);
String tformatdt = TalendDate.formatDate("yyyy-MM-dd'T'HH:mm:ss.SSSXXX", tempDate);
System.out.println(tformatdt);
</pre>
Output:
<pre>
Date from DB: 2020-08-14T08:59:34.961+05:30
2020-08-13T23:29:34.961-04:00
</pre>
If you see, when Talend Parses the date, it does not remember the original TimeZone.. It is changed from +05:30 to -04.00 (which is my local tz).
Any suggestions on how to maintain the original TimeZone of +05:30?
Thank you in advance.
Bump..
@Shicong Hong