Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Checking whether the date entered within textfield does comply with the format given  RSS feed

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have a text field, named "datedtext", which accepts date from user.

The property associated with date is of Date datatype in my entity class. What i want is that when the user enters the date and press enter, it should check whether it complies to format given.

Here is what i tried



How can i check whether it is in a given format? If it complies, parse() method will convert it into Date object.
All suggestions are welcomed.
Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
scroll down the topics on the first page for
'leave maskformatter null' (or similar)

you'll find an example there
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!