If you want to close your JFrame, you just need to call:
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
yourFrame.setDefaultCloseOperation(JFram.EXIT_ON_CLOSE);
This ensures that when you press "X" button on your frame, it will close like any other frame.
And as for using date values in java, look into this class:
java.util.Date
Best regards.