This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Checking whether the date entered within textfield does comply with the format given Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Checking whether the date entered within textfield does comply with the format given" Watch "Checking whether the date entered within textfield does comply with the format given" New topic
Author

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

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 622
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


kunal
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
scroll down the topics on the first page for
'leave maskformatter null' (or similar)

you'll find an example there
 
 
subject: Checking whether the date entered within textfield does comply with the format given
 
Similar Threads
SimpleDateFormat parses illegal date string
Convert String in Date
data handling
Date,Calendar?help!!!!
Validation before conversion