[xsl] Adding xs:time to xs:dateTime

Subject: [xsl] Adding xs:time to xs:dateTime
From: Florent Georges <lists@xxxxxxxxxxxx>
Date: Sat, 16 Feb 2008 17:16:34 +0100 (CET)
  Hi

  I faced today a simple problem for which I can't think of a simple
and concise solution.  I have an xs:date and an xs:time that together
represent a datetime.  I'd simply like to get this actual xs:dateTime. 
For instance from 2008-02-14 and 12:34:56-06:00 to
2008-02-14T12:34:56-06:00.

  The simplest solution I found is to build a duration from the time
and add it to a datetime built from the date, then adjust the timezone:

    adjust-dateTime-to-timezone(
      xs:dateTime($date)
        + xs:dayTimeDuration(
            concat(
              'PT',
              hours-from-time($time), 'H',
              minutes-from-time($time), 'M',
              seconds-from-time($time), 'S')),
      timezone-from-time($time))

  I feel I missed something simple here...  Any comment?

  Regards,

--drkm




















      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail http://mail.yahoo.fr

Current Thread