This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
jashaswini jagadeb wrote:hi...
i want to get the date from textField of any format in swing. (i.e.dd/mm/yyyy or dd.mm.yyyy or dd-mm-yyyy) .please reffer the code.
please help me.
thanks in advance.
Hi jashaswini, this is NotACodeMill, so we won't just give you code to use, but we can help you with your problem. Have a look at the DateFormat, and its implementing SimpleDateFormat child classes. They provide tools for parsing many of the common date formats - with the ability to pass in your own custom format String. You won't be able to use a single format to parse 'any format', you will have to provide a specific set of formats that are recognized.
Take a look at those classes and try out some code. If you have problems come on back and let us know and we can help you work through them.
There are many samples that you can google that gives you a button on pressing them you can see the calender where specific dates can be clicked which you can trap. You can use these dates for your application. Please find something similar. This will eliminate users to make mistakes.