Hello All,
This the the code i am using to convert date in different time zone date but it is not working on Cumulocity tenant where as on local it is working fine.
private String getGMTTimeZoneDate(String date) throws ParseException {
DateTimeZone gmtTime = DateTimeZone.forTimeZone(TimeZone.getTimeZone("GMT"));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMM dd yyyy hh:mm:ss aa");
DateTime timeZoneStartDate = new DateTime(simpleDateFormat.parse(date));
return timeZoneStartDate.withZone(gmtTime).toString();
}
Local date conversion output
Input IST date : Mar 04 2024 05:51:12 PM
Output GMT date : 2024-03-04T12:21:12.000Z
On dev Cumulocity tenant conversion output
Input IST date : Mar 04 2024 05:51:12 PM
Output GMT date : 2024-03-04T17:51:12.000Z (Not converted as per given time zone)
Let me know , what is wrong with this.
Regards/-
Prakahs