• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

user input date?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

i have to connect to a server and get the history details of telephone calls. to that i have a client with me. before get the history the start date and end date should be given. this is done in console. can somebody explain how to do this? thanks in advance.

ushan
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, what exactly is your question? How to read input from a console window, or how to parse the input into a Date object?

For reading text from a console window, you could use class java.io.Console (if you're using Java 6), or use a BufferedReader to read a line from System.in. To parse the input into a Date object, use class java.text.SimpleDateFormat. Lookup those classes in the API documentation.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper Young wrote:For reading text from a console window, you could use class java.io.Console (if you're using Java 6), or use a BufferedReader to read a line from System.in.


Or java.util.Scanner if you're using Java 5.0; it's easier to use (with parsing etc) than BufferedReader. It can't parse directly to a Date though, so the SimpleDateFormat should still be used.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic