posted 21 years ago
I am trying to create a variable of type date from user input. I want it to be only a date, not time and other things in the variable, so I thought that parsing the input with
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
would accomplish that (according to the documentation, SHORT would be only a date dd-mm-yyyy). However, when I output the variable, I get the day, time and timezone, which I am not at all intrested in.
Code that parses and saves variable
Date Pn = df.parse(in.readLine());
How should I initialize the DateFormat?