• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

SpinnerDateModel

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I solved it by using SimpleDateFormat.format(Date date). It returns a String which is enough for me.
 
reply
    Bookmark Topic Watch Topic
  • New Topic