• Post Reply Bookmark Topic Watch Topic
  • New Topic

strange error for displaying date

 
Mona Richerdson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having following code in my file.

<h:inputText id = "startdate" value="#{myBean.myDataItem.start_date}" required="true">
<f:convertDateTime pattern="MM-dd-yy"/>

</h:inputText> (mm-dd-yy)

it works correctly but while displaying start date on my form, it displays the date by 1 one day less.
like if it is (in MM-dd-yy) 03-04-07 it displays 03-03-07

can anybody help me

Thanks
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try printing your date instance from backing/managed bean ? your code is working good for me. I created an instance of data object in backingbean and binded it to the inputText.

Thanks,
[ March 12, 2007: Message edited by: Rajeev Ravindran ]
 
Remko Strating
Ranch Hand
Posts: 893
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my experience JSF shows 1 one day less. If there is no
<f:convertDateTime /> pattern related to this.

Did you do that also with your startdate?
Is your backingbean sending a valid date?

If not this converter will not be active.
 
Kumar Saravanan
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mona,

I experienced the same problem while persisting the date into the database. It reduces the entered date by one (1).

If you debug the code (probably the setter method for that date property), you will find out the problem.

Basically if you use the pattern as MM-dd-yyyy then the problem exists with the converter. We modified back to different date format pattern. I think there will some problem with that pattern but not 100% sure...

Thanks,
Kumaran Saravanan
 
Rajeev Ravindran
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wonder why I'm not facing this issue
 
Tim Holloway
Bartender
Posts: 18411
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the clock when you're doing this. If you aren't handling time localizations properly in both directions it can make the day change.

Right now, it's still Monday UTC and Monday EDT. But in about 20 minutes that won't be true anymore.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!