0

I am taking date input using jdatepicker :

UtilDateModel model = new UtilDateModel();
JDatePanelImpl datePanel = new JDatePanelImpl(model);
final JDatePickerImpl datePicker = new JDatePickerImpl(datePanel);
datePicker.setBounds(200,430,140,40);

I am taking time input using JSpinner :

final JSpinner spinner1 = new JSpinner();
SpinnerDateModel spinnermodel = new SpinnerDateModel();
spinnermodel.setCalendarField(Calendar.MINUTE);
spinner1.setModel(spinnermodel);
final JSpinner.DateEditor de = new JSpinner.DateEditor(spinner1,"hh:mm");
spinner1.setEditor(de);

How should i set them to make a timestamp which is to be entered in the MS Access Database.

mKorbel
  • 109,525
  • 20
  • 134
  • 319
Prakhar
  • 530
  • 10
  • 24
  • See the class java.util.Calendar. It has all method to merge two Date object and then you can create a Timestamp: new Timestamp(calendar.getTimeInMillis()) – Sergiy Medvynskyy Jul 07 '14 at 10:13
  • i want to enter my own time and date ... how can i do that ... and then making a time stamp – Prakhar Jul 07 '14 at 10:32
  • [SpinnerDateModel.getDate()](http://docs.oracle.com/javase/7/docs/api/javax/swing/SpinnerDateModel.html#getDate%28%29)? – rlegendi Jul 07 '14 at 10:40
  • I want user to enter the date... and time please explain .. i am not that familiar with Spinner class – Prakhar Jul 07 '14 at 10:46
  • You could call `getDate()` on your `SpinnerDateModel` and format this `Date` with a `SimpleDateFormat` to the Timestamp you want. And you'll need only the `JSpinner`, because you can enter Date and Time with this `Component`. – Patrick Jul 07 '14 at 11:44
  • After getting the date from the getDate method , how to make the timestamp – Prakhar Jul 07 '14 at 12:00

0 Answers0