• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

f:convertDateTime substracting a day

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am very confused I have date input on a page and using <f:convertDateTime> for conversion on my bean one day is subtracting from the date user enters.
If user enters 02/01/2009, it is changed to 01/31/2009. Is this a bug with this tag. Comments/Suggestions/workaround?

Thanks.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Yasir Qureshi wrote:I am very confused I have date input on a page and using <f:convertDateTime> for conversion on my bean one day is subtracting from the date user enters.
If user enters 02/01/2009, it is changed to 01/31/2009. Is this a bug with this tag. Comments/Suggestions/workaround?

Thanks.



you have to enter your timeZone to fix this: an example would be:

<h:outputText value="#{fax.date}" >
<f:convertDateTime timeZone="Turkey"/>
</h:outputText>

you can search for your timezone, and put it there.
 
Yasir Qureshi
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Darkin it worked.
 
Saloon Keeper
Posts: 28070
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just to make it clear. If you don't explicitly provide a timezone, the displayed date is based on UTC. And when it's 3 am in Greenwich, England, it's still evening in New York.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also use

the seam taglib. This doesn't have the bug that JSF tag has. If you use this taglib you needn't specify the default timezone.
 
Villains always have antidotes. They're funny that way. Here's an antidote disguised as a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic