I have a web-form where users can select a date from a calendar pop-up and a time from a dropdown. At the moment I am trying to store the date using a Date object.
Try this:
SimpleDateFormat dateFormatter = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm:ss");
String dateAsString = dateFormatter.format(date);
String timeAsString = timeFormatter.format(date);
Have a look at the Calendar
class. It has all of the methods required to get different "date parts". Also, look at the SimpleDateFormat
class in java to format the date in needed way.
Calendar - http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html
SimpleDateFormat - http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html