Hi,
As per the current implementation of C5, we are storing the timestamp
values in the APIM server's default time zone.
We have faced many issues in the past due to the mismatch between client
browser time zone and server's time zone which results in the display of
incorrect data.
*Solution:*
1. Store date time in UTC along with the origin timezone.
UTC is the least widely used format to store times, as it does not denote
any timezone offset. This allows to purpose dates as needed throughout the
system in whatever timezone is appropriate.
2. Return time zones in UTC
UTC will allow API consumers the freedom to offset the date to their local
time zone.
The react applications will have to convert the time zone from UTC to
browser time zone.
*Implementation:*
The current implementation we are setting the time stamp as below which
returns the time in local time zone.
Timestamp.valueOf(LocalDateTime.now());
We can force the JVM to use UTC at the startup using,
TimeZone.setDefault(TimeZone.getTimeZone("Etc/UTC"));
then Timestamp.valueOf(LocalDateTime.now()) will return time stamp in UTC.
Appriciate your thoughts on this.
--
*Thanks and Regards,*
Anuruddha Lanka Liyanarachchi
Software Engineer - WSO2
Mobile : +94 (0) 712762611
Tel : +94 112 145 345
a <[email protected]>[email protected]
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture