I'm pulling a date string from a SQL table. The date string being pulled from Sql is...
2020-07-28 15:35:45.9375232 -05:00
and when I try and parse and format, it's returning a different time than what was passed in.
Method1:
String record = data.getValue(4, 1)
// returns "2020-07-28 15:43:16.5168174 -05:00" from SQL table
def formattedDate = Date.parse("yyyy-MM-dd HH:mm:ss.SSSSSSS XXX", record).format("yyyy-MM-dd'T'HH:mm:ss.SSS")
log.logInfo("queried date = " + formattedDate)
Returns 2020-07-28T17:09:24.174
and Method2:
def queriedDate2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSSS XXX").parse(record)
log.logInfo("queriedDate2= " + queriedDate2)
Returns Tue Jul 28 17:09:24 CDT 2020
Can anyone help me understand what's going on?