File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes SpinnerDateModel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SpinnerDateModel" Watch "SpinnerDateModel" New topic
Author

SpinnerDateModel

Matti Poro
Ranch Hand

Joined: Dec 03, 2005
Posts: 41
I have a JSpinner that uses SpinnerDateModel and I need to get the selected day, month and year. SpinnerDateModel has a method getDate() which returns a Date object and Date has methods getDay(), getMonth() and getYear(). The problem is that those methods are deprecated.
The API says for Date.getDay(): "Deprecated. As of JDK version 1.1, replaced by Calendar.get(Calendar.DAY_OF_WEEK)."
I can't find a way to convert Date to Calendar or to GregorianCalendar. Does anyone know how I can get the values without using deprecated methods?
Matti Poro
Ranch Hand

Joined: Dec 03, 2005
Posts: 41
I solved it by using SimpleDateFormat.format(Date date). It returns a String which is enough for me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SpinnerDateModel
 
Similar Threads
java Timestamp
Calculate date difference [Gregorian calender]
How to calculate numbers until it returns a single number?
JSpinner SpinnerDateModel
How to insert date values to database using java swings