- From: Xavier Franc <xfranc@online.fr>
- Date: Fri, 03 Oct 2003 14:37:07 +0200
- To: public-qt-comments@w3.org
Here is a suggestion for a supplemental convenience feature that will hopefully make everybody happy: get-XXX-from-dateTime accepts an optional second argument 'timezone' such that get-hours-from-dateTime($dt, $tz) is equivalent to: get-hours-from-dateTime(adjust-dateTime-to-timezone($dt, $tz)) This way the following expression returns the normalized UTC component: get-hours-from-dateTime($dt, 0) (Note: using the duration notation proposed by Michael Kay) while the following expression returns the component as specified initially (i.e. using the timezone that was specified or implicit when the date/time object $dt was created): get-hours-from-dateTime($dt) to get the component in the implicit timezone: (not necessarily the same as above) get-hours-from-dateTime($dt, implicit-timezone()) -- Xavier FRANC > http://lists.w3.org/Archives/Public/public-qt-comments/2003Sep/0124.html > > suggested that the date/time component extraction functions (for example, > get-hours-from-dateTime()) should return components of the localized time, > rather than the normalized time. > > (Terminology: localized time = the time in the timezone represented by the > timezone component of the value; normalized time = the same instant of time > represented in timezone UTC) > > On reflection, I'm inclined to agree with Xavier: I think we have got this > wrong. The date/time is presented in localized form when converting it to a > string, and when using the XSLT format-dateTime() family of functions. I > think it will be less confusing if we consistently present date/time values > in the localized form, and require users to use adjust-X-to-timezone if they > want something different. > > Currently, if you want the components of the localized value, you have to > call adjust-dateTime-to-timezone() with () as the second argument, and then > call get-hours-from-dateTime. > > With this change, a user who wanted components of the normalized value would > use adjust-dateTime-to-timezone() to adjust the timezone to UTC, and then > extract the component values. > > Specifically (in XQuery syntax): > > let $utc := xdt:dayTimeDuration("PT0H"), > $ndt := adjust-dateTime-to-timezone($in, $utc) return > get-hours-from-dateTime($ndt) > > We might also want to consider changing the default for the second argument > of adjust-X-to-timezone() so it adjusts to UTC, since adjusting to the local > timezone can easily be achieved by supplying implicit-timezone() as the > second parameter. Alternatively, if my proposal on durations is accepted, > then adjust-dateTime-to-timezone($in, 0) will return the normalized value. >
Received on Friday, 3 October 2003 08:37:43 UTC