Re: date:date-time()

Jeremy Kloth <[email protected]>
Newsgroups gmane.text.xml.xslt.extensions
Organization Fourthought, Inc
Message-ID <[email protected]>
On Thursday 05 January 2006 12:30, Jeremy Kloth wrote:
> The current spec for date-time() allows for either UTC (Z) or local
> (-/+HH:MM) timezones.  If an implementation decides to use UTC there is no
> way to determine what the local offset would be.  This also chains to the
> rest of the functions as they then operate only on the UTC date/time.
>
> There should be some way of working with both the UTC and offset-based
> timezones.  Some ideas:
>
> - mandate that date:date-time() allows uses the offset notation;
>
> - have date:date-time() grow an optional boolean argument that specifies
> with to return the timezone in UTC or offset notation;
>
> - add an additional function, say date:convert-timezone(), that switches
> from offset to UTC notation;
>
> - add an addition function, date:utc-offset(), that returns a duration that
> represents the offset of the given date/time or current time.
>
> As it stands, the lack of control, by the user, over which format can cause
> confusion.  For example, there was a comment on #4suite whether
> day-in-year() was working because it was returning 1 day later than it
> would have been if it was in local time.
>
> This issue needs to be resolved in some fashion, i'm leaning towards the
> optional argument to date:date-time(), that when present and true, UTC
> notation is used, otherwise offset notation.  I choose offset notation as
> that is what is implemented by the Javascript versions and by the majority
> of the processors (all except 4Suite which defaults to 'Z').

Just responding to myself to add some followup research.  The "status quo" wrt 
the default timezone is the offset (-/+HH:MM) notation.  The reference 
implementations as well as libxslt, saxon and xalan all return with that for 
those functions that have a "default" value of the current time.  4Suite is 
the odd-man-out in this one.

Some questions for the users of EXSLT Dates and Times out there:

- is the return value of "local time" what you are expecting?

- is "current time" just not used and therefore the TZ not an issue?  In other 
words, only preexisting date/time strings are used.

- are dates/times in UTC not really important (or simply unused)?

OK, so now I'm going with the notion that date:date-time() ALWAYS returns 
"local time".  Also an additional function, date:convert-timezone() is added 
to handle the need for UTC (and other) timezones.  In template syntax:

<xsl:call-template name="date:convert-timezone">
   <xsl:with-param name="date-time" select="string" />
   <xsl:with-param name="timezone" select="string" />
</xsl:call-template>

where date-time is either xs:dateTime or xs:time and timezone is either 'Z' or 
'+/-HH:MM'.

Here is hoping to having some constructive discussion...

-- 
Jeremy Kloth
http://fourthought.com/
http://4suite.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.