icatproject / icat.server

The ICAT server offering both SOAP and "RESTlike" interfaces to a metadata catalog.
Other
1 stars 5 forks source link

Datetime field values differ in format #309

Open VKTB opened 1 year ago

VKTB commented 1 year ago

I have an investigation in my database with the following CREATE_TIME and MOD_TIME values:

CREATE_TIME: 12-SEP-07 13.59.58.000000000
MOD_TIME: 09-MAR-20 15.19.49.823000000

When I queried for this investigation over SOAP, I noticed that the values for these fields differ in format (the former ends with +01:00 whereas the latter ends with Z):

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:searchResponse xmlns:ns2="http://icatproject.org">
            <return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:investigation">
                <createTime>2007-09-12T13:59:58+01:00</createTime>
                <modTime>2020-03-09T15:19:49.823Z</modTime>
            </return>
        </ns2:searchResponse>
    </S:Body>
</S:Envelope>
RKrahl commented 1 year ago

What database backend are you using for icat.server?

RKrahl commented 1 year ago

Note that if I take these dates without any time zone indication as British local time I get:

$ TZ=Europe/London date -d "2007-09-12T13:59:58" --iso-8601=second
2007-09-12T13:59:58+01:00
$ TZ=Europe/London date -d "2020-03-09T15:19:49.823" --iso-8601=second
2020-03-09T15:19:49+00:00

E.g. for the 2020-03-09 GMT is in force, whereas for the 2007-09-12 we have BST. So apparently the values you get are consistently British local time. The time zone Z is just a (ISO 8601) synonym for +00:00.

VKTB commented 1 year ago

What database backend are you using for icat.server?

It is pointed at an Oracle database.

RKrahl commented 1 year ago

It is pointed at an Oracle database.

AFAIR, Oracle stores date and time values without any time zone indication. I believe, it then depends on the locale setting of the Payara process what time zone it assumes when reading those values from the database. The values you quote would then be consistent with a British locale setting.