• 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
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Problem with the Calendar

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am using the Calendar to setup a date string to display and I obtain each part separately using the Calendar.getInstance.get() method and passing it the DAY_OF_MONTH, MONTH, YEAR variables. The problem is I am currently getting a 0 for month. What I am doing wrong ?
Thanks
Daniel Serrano
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're doing nothing wrong. For some reason, Calendar uses a 0-based index for months. I.e. 0=January, 1=February, 2=March and so on.
 
Daniel Serrano
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot, it would probably have taken me some time to figure that out as I was assuming there was a problem and Calendar was only returning the first digit of the month. Thanks.
reply
    Bookmark Topic Watch Topic
  • New Topic