View Single Post
  #2 (permalink)  
Old 11-03-2007, 07:52 PM
JavaBean's Avatar
JavaBean JavaBean is offline
Moderator
 
Join Date: May 2007
Posts: 1,272
JavaBean is on a distinguished road
You can ask the user to enter the date in a predefined format. Then you can palce it into a String and pass it to your GregorianCalendar calls as you show in your code block.

Here is how you can get a String from the user via console:

Code:
BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String input = in.readLine();
If your application has a GUI, you can also use following method:

Code:
ans = JOptionPane.showInputDialog(null, "Please enter date below:");
Reply With Quote