xsl-list
[Top] [All Lists]

Re: [xsl] calculate UTC

2012-06-24 11:35:40
thanks, I need only the difference and your script bello helps:
<xsl:value-of 
select="timezone-from-dateTime(xsd:dateTime(concat(MSG/DTE,'T',TME)))- 
implicit-timezone()"/>
But the result must be only the difference in hhmm format.
result sample: 0212
?
        

--- G. Ken Holman <gkholman(_at_)CraneSoftwrights(_dot_)com> schrieb am So, 
24.6.2012:

Von: G. Ken Holman <gkholman(_at_)CraneSoftwrights(_dot_)com>
Betreff: Re: [xsl] calculate UTC
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com, "xslforum xslforum" 
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Datum: Sonntag, 24. Juni, 2012 17:24 Uhr
At 2012-06-24 15:53 +0100, henry
human wrote:
I have following element, TIME as bellow and want to
calculate the UTC time difference
between that time and the local time (local time Hong
Kong)
<STSF>
<DTE>2012-06-14</DTE>
<TME>06:20:00.0Z</TME>
</STSF>

Again, I'm guessing here ... not sure if you want just the
time difference between time zones, or if you want the given
UTC time in your local time.

I'm executing this test in Atlantic Daylight Savings Time
(UTC - 03:00), so I'm getting the results for my local
time.  If your machine's time zone is set to Hong Kong
time, then you'll get the results for your time zone.

I hope this helps.

. . . . . . . . .  Ken

~/t/ftemp $ cat henry2.xml
<?xml version="1.0" encoding="UTF-8"?>
<STSF>
<DTE>2012-06-14</DTE>
<TME>06:20:00.0Z</TME>
</STSF>
~/t/ftemp $ xslt2 henry2.xml henry2.xsl
<?xml version="1.0" encoding="UTF-8"?>
Local time zone: -PT3H
Time zone difference: PT3H
File time in local time: 2012-06-14T03:20:00-03:00
~/t/ftemp $ cat henry2.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  exclude-result-prefixes="xsd"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  version="2.0">

<xsl:output indent="yes"/>

<xsl:template match="STSF">
Local time zone: <xsl:value-of
select="implicit-timezone()"/>
Time zone difference: <xsl:value-of
   
select="timezone-from-dateTime(xsd:dateTime(concat(DTE,'T',TME)))
            -
implicit-timezone()"/>
File time in local time: <xsl:value-of
               
         
select="adjust-dateTime-to-timezone(
               
               
  xsd:dateTime(concat(DTE,'T',TME)),
               
               
  implicit-timezone())"/>
  <xsl:text>&#xa;</xsl:text>
</xsl:template>

</xsl:stylesheet>
~/t/ftemp $


--
Public XSLT, XSL-FO, UBL and code list classes in Europe --
Oct 2012
Contact us for world-wide XML consulting and instructor-led
training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.         
  http://www.CraneSoftwrights.com/s/
G. Ken Holman           
       mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>