OneSpan Callback not returning GMT-0 time
Friday, September 16, 2022 at 01:00pmI am currently in CST/ GMT-5 but the callback is returning GMT-4 for the createdDate time.
I am on the onespan sandbox could this have an effect?
Edit: updated subject to GMT-0 time
Reply to: OneSpan Callback not returning GMT-0 time
Friday, September 16, 2022 at 01:04pmAttached is the picture showing the event callback time.
Reply to: OneSpan Callback not returning GMT-0 time
Monday, September 19, 2022 at 09:45amHi Nemo,
Thanks for your post! Please note that the Date String OSS callback service returns is always in GMT time, an example looks like below:
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_CREATE","sessionUser":"18EZDL44xgsX","packageId":"wVdZEaPD2igwUnFGJBjDD0dpO7k=","message":null,"documentId":null,"createdDate":"2018-06-30T20:04:55.384Z"}
It's in format of: yyyy-MM-dd'T'HH:mm:ss'Z'
In Java Code, if you are using ZonedDateTime to convert time zone, it could look like below:
GMT ---> Local
ZonedDateTime gmt = ZonedDateTime.parse("2022-09-19T14:13:00Z");
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
String zoneId = "America/Montreal";
ZonedDateTime zonedDateTime;
if (zoneId.length() == 3) {
zonedDateTime = gmt.withZoneSameInstant(ZoneId.of(zoneId, ZoneId.SHORT_IDS));
} else {
zonedDateTime = gmt.withZoneSameInstant(ZoneId.of(zoneId));
}
System.out.println(zonedDateTime.format(fmt));
From the screenshot you supplied, I think the 1 hour offset might be caused during this conversion
On the opposite, if you are converting local time to GMT time, you can use code similar to below:
Local ---> GMT
Date date = new Date();
String strDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(date);
ZonedDateTime utc = ZonedDateTime.parse(strDate);
ZonedDateTime zonedDateTime2;
if (zoneId.length() == 3) {
zonedDateTime2 = utc.withZoneSameLocal(ZoneId.of(zoneId, ZoneId.SHORT_IDS));
} else {
zonedDateTime2 = utc.withZoneSameLocal(ZoneId.of(zoneId));
}
ZonedDateTime utcZonedDateTime = zonedDateTime2.withZoneSameInstant(ZoneOffset.UTC);
System.out.println(utcZonedDateTime.format(fmt));
For time zone ID, you can get a list of OSS supported time zones from this API:
GET /api/eslTimeZones
Duo
Reply to: OneSpan Callback not returning GMT-0 time
Tuesday, September 20, 2022 at 12:01pmShouldn't OneSpan callbacks be sending the timestamp using GMT-0 as mentioned here? https://www.onespan.com/blog/onespan-sign-release-1121-time-zone-support
I am aware that there is a difference between my local time and the callback time, but I was expecting the callback to send the timestamp using GMT-0 and not GMT-4
as displayed in the blog. Since I am tracking the status on our application using these timestamps, I need to know which time zone I should use.
Can you confirm that the onespan callbacks are using GMT-0 or GMT-4?
Reply to: OneSpan Callback not returning GMT-0 time
Tuesday, September 20, 2022 at 12:04pmGMT ---> Local
ZonedDateTime gmt = ZonedDateTime.parse("2022-09-19T14:13:00Z");
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
String zoneId = "America/Montreal";
Also from this code you shared, America/Montreal is GMT-4 which seems like that is what timestamp the callback is using.
Reply to: OneSpan Callback not returning GMT-0 time
Tuesday, September 20, 2022 at 12:24pmHi Nemo,
I can confirm that all time string OneSpan Sign sends to you are in GMT (GMT-0) time. A quick proof is that you can print out the callback payload in plain text and check the value. Below is an example that OSS callback service just sent to me:
{"@class":"com.silanis.esl.packages.event.ESLProcessEvent","name":"PACKAGE_CREATE","sessionUser":"ATQOPd60xE4V","packageId":"3wyKgrhFUiOXnl7oC_I_3-183Qk=","message":null,"documentId":null,"createdDate":"2022-09-20T17:22:26.270Z"}
Duo