timezone always displays as UTC for display of xs:dateTime and xs:time

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

timezone always displays as UTC for display of xs:dateTime and xs:time

Doug Young

Hi,

  We have noticed that the timezone always displays as UTC for the display of xs:dateTime and xs:time

 

replacing UTC with [ZN] in properties.xml fixes this problem.

 

cheers

   Doug

 

 

 

Doug Young

Software Engineer

 

Teleflex IT

1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

+44 (0) 1506 407107

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: timezone always displays as UTC for display of xs:dateTime and xs:time

Alessandro  Vernet
Administrator
Hi Doug,

Thank you for the tip. This is quite useful indeed. We added a note to
that effect in the part of the XForms reference that covers those
properties.

Alex

On 11/2/06, Doug Young <[hidden email]> wrote:

>
>
>
>
> Hi,
>
>   We have noticed that the timezone always displays as UTC for the display
> of xs:dateTime and xs:time
>
>
>
> replacing UTC with [ZN] in properties.xml fixes this problem.
>
>
>
> cheers
>
>    Doug
>
>
>
>
>
>
>
> Doug Young
>
> Software Engineer
>
>
>
> Teleflex IT
>
> 1 Michaelson Square
>  Livingston
>  West Lothian
>  Scotland
>  EH54 7DP
>
>
> +44 (0) 1506 407107
>
>
>
> --
> You receive this message as a subscriber of the [hidden email]
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: timezone always displays as UTC for display of xs:dateTime and xs:time

archana
In reply to this post by Doug Young
Hi there,

As you said , i have change the property tag in properties-local.xml as
<property as="xs:string" name="oxf.xforms.format.date" value="if (. castable as xs:date) then format-date(xs:date(.), '[FNn] [MNn] [D], [Y]', 'en', (), ()) else ."/>

<property as="xs:string" name="oxf.xforms.format.dateTime" value="if (. castable as xs:dateTime) then format-dateTime(xs:dateTime(.), '[FNn] [MNn] [D], [Y] [H01]:[m01]:[s01] [ZN]', 'en', (), ()) else ."/>

<property as="xs:string" name="oxf.xforms.format.time" value="if (. castable as xs:time) then format-time(xs:time(.), '[H01]:[m01]:[s01] [ZN]', 'en', (), ()) else ."/>

But still the created on and last modified time are displaying as UTC.

Did i miss anything in above tag



Doug Young wrote
Hi,

  We have noticed that the timezone always displays as UTC for the display
of xs:dateTime and xs:time

 

replacing UTC with [ZN] in properties.xml fixes this problem.

 

cheers

   Doug

 

 

 

Doug Young

Software Engineer

 

Teleflex IT

1 Michaelson Square
Livingston
West Lothian
Scotland
EH54 7DP

+44 (0) 1506 407107

 



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: timezone always displays as UTC for display of xs:dateTime and xs:time

Alessandro  Vernet
Administrator
Hi,

Looking at this, I am not sure how using [ZN] could have the effect of showing the time in the current time zone. From what I see in the spec, this just displays the timezone.

http://www.w3.org/TR/xslt20/#date-picture-string

Instead, I think you'll want to call adjust-dateTime-to-timezone(), as in the expression below. This assume that the local timezone on your system is the one you want. If you want to be more explicit or need another time zone to be used, that function can take a second parameter with the time zone.

format-dateTime(adjust-dateTime-to-timezone(xs:dateTime(.)), '[FNn] [MNn] [D], [Y] [H01]:[m01]:[s01] [ZN]', 'en', (), ())

http://www.w3.org/TR/xpath-functions/#timezone.functions

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: timezone always displays as UTC for display of xs:dateTime and xs:time

archana
Hi Alessandro,

Thank you for your quick response. I have used the property tag as you said but still it is displaying UTC format and not taking my current time zone . Below is the tag which i changed as you said

<property as="xs:string" name="oxf.xforms.format.dateTime" value="if (. castable as xs:dateTime) then format-dateTime(adjust-dateTime-to-timezone(xs:dateTime(.)), '[FNn] [MNn] [D], [Y] [H01]:[m01]:[s01] [ZN]', 'en', (), ()) else ."/>


Alessandro Vernet wrote
Hi,

Looking at this, I am not sure how using [ZN] could have the effect of showing the time in the current time zone. From what I see in the spec, this just displays the timezone.

http://www.w3.org/TR/xslt20/#date-picture-string

Instead, I think you'll want to call adjust-dateTime-to-timezone(), as in the expression below. This assume that the local timezone on your system is the one you want. If you want to be more explicit or need another time zone to be used, that function can take a second parameter with the time zone.

format-dateTime(adjust-dateTime-to-timezone(xs:dateTime(.)), '[FNn] [MNn] [D], [Y] [H01]:[m01]:[s01] [ZN]', 'en', (), ())

http://www.w3.org/TR/xpath-functions/#timezone.functions

Alex
Reply | Threaded
Open this post in threaded view
|

Re: timezone always displays as UTC for display of xs:dateTime and xs:time

Alessandro  Vernet
Administrator
Hi archana,

Then this might be because UTC is setup as the default time zone on your system. In that case, you can specify your time zone as the second parameter to adjust-dateTime-to-timezone(). BTW, you can try those functions on:

http://localhost:8080/orbeon/sandbox-transformations/xpath/

For instance:

format-dateTime(adjust-dateTime-to-timezone(xs:dateTime('2013-06-26T21:50:41.000Z'), xs:dayTimeDuration("-PT7H")), '[FNn] [MNn] [D], [Y] [H01]:[m01]:[s01] [ZN]', 'en', (), ())

Will show: Wednesday June 26, 2013 14:50:41 -07:00. You see that it took the UTC time (21:50) et changed it to a PDT time, my local time zone (14:50).

Is specifying an offset as done above good enough for your use case?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: timezone always displays as UTC for display of xs:dateTime and xs:time

Alessandro  Vernet
Administrator
Hi archana,

As a side-note, setting the oxf.xforms.format.dateTime property won't work for the Form Runner summary page, as it it uses its own custom format. If you want to change how dates are formatted on the summary page, for now, you need to change the Form Runner code, in resources/apps/fr/summary/view.xhtml. In that file, there are 3 occurrences of xs:dateTime(…) which you'll want to change to adjust-dateTime-to-timezone(xs:dateTime(…)). This isn't quite ideal, and I added an RFE to improve this:

https://github.com/orbeon/orbeon-forms/issues/1101

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: timezone always displays as UTC for display of xs:dateTime and xs:time

Alessandro  Vernet
Administrator
As a follow up on this, our latest code now calls dateTime-to-timezone() as suggested in my previous message. This will be in the upcoming 4.4 release. However, issue #1101 still stands as it is about adding a property to setup the time zone instead of relying on the system default time zone.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet