W3C home > Mailing lists > Public > public-qt-comments@w3.org > September 2003

Re: SAG-FO-02 follow-up: Durations

From: Xavier Franc <xfranc@online.fr>
Date: Tue, 23 Sep 2003 00:42:23 +0200
Message-ID: <3F6F7ACF.5030507@online.fr>
To: public-qt-comments@w3.org

Additional remarks about timezones: it seems there are some issues here.
Some were already addressed by David Holmes in may 2003.

The Data Model (or internal representation) of dateTime et al.
  is "a normalized value with timezone Z and a timezone represented as etc."

The internal representation is what it is, but it should not influence the
external behavior.

- The current behavior of date/time component extraction functions
   like get-hours-from-dateTime is to return components of the normalized value (UTC).

   It means for example that (excerpt from the current draft, section 9.4.10):

   [with an implicit timezone value of -05:00]
      fn:get-hours-from-dateTime( xs:dateTime("1999-12-31T12:00:00") )
   returns 17 !!!

   This is very disconcerting and, to put it bluntly, nonsensical.
   I think authors of books about XML Query/XLST will have a hard time
   to explain that to their readers!

   Naive users working in their own implicit timezone should not have to care about
   the actual timezone and have to do complex adjustments to get correct results.

- Then what is the meaning of functions adjust-XXX-to-timezone ?
   what can be adjusted ?
   The WD gives this example among others:

    fn:adjust-dateTime-to-timezone( xs:dateTime("2002-03-07T10:00:00-07:00"),
       returns 2002-03-08T03:00:00+10:00

    But due to the normalization this is exactly the same thing!
    So the function is the identity ?

    Or is there a confusion between the object and its external string
    representation ? Then we are in fact speaking of formatting functions.

Proposed modifications:

* The component extraction functions yield the *local* values
   (ie corresponding to the timezone)

   for example
             fn:get-hours-from-dateTime( xs:dateTime("1999-12-31T12:00:00") )
     returns 12 whatever the timezone.

   This seems much more intuitive and natural.

* The adjust-to-timezone functions produce a different object with
   the same UTC value but a different timezone.
   Therefore component extraction functions on the resulting object
   yield different values:

    For example:

      let $dt := xs:dateTime("1999-12-31T12:00:00Z"),
          $adjusted := adjust-dateTime-to-timezone($dt, xdt:dayTimeDuration("PT2H"))
        return get-hours-from-dateTime($adjusted)

    returns 14
    and xs:string($adjusted) is "1999-12-31T14:00:00+02:00"

* Add a formatting function yielding a string.

Xavier FRANC
Received on Monday, 22 September 2003 18:42:00 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:56:49 UTC