In my application user needs to input date. I read the Java API and found that I can solve this with the following code
dataReceivedDateSpinner = new JSpinner(new SpinnerDateModel());
I have two problems.
First: dataReceivedDateSpinner displays year, month, day, hour and minutes. And it is displaying it as far as I can tell according to system time settings. On my home computer which runs Linux format is 4/30/10 9:10 PM. At work where we use Serbian Windows settings format is petak 30.4.2010 21:10. Is there a way for me to set the format to let say DD/MM/YYYY. I would like system independent formating. Plus I don't need the time just the date. Is there a way to at least turn the time off and is there a way to tell the JSpinner or SpinnerDateModel in which format I want data to be displayed.
Second: I can get the Date from dataReceivedDateSpinner and set value in the following fashion
Date date = (Date) dataReceivedDateSpinner.getModel().getValue();
Problem is that, as far as I understood Java api, most methods of Date class are deprecated. Recommendation is not to use them. I have fields in my classes that I want to use for dates and those fields are instances of GregorianCalendar. I googled extensively but found no way to switch back and forth betwen GregorianCalendar class and Date class.
Is there a way to use some up to date class to store date information and convert data from Date class to that up to date class and back or do I have to use deprecated methods of the Date class. I would really like to avoid using Date class methods because they are deprecated.
Thanks in advance