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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Java Calendar Dates

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi all,

I am currently building a payroll software code and stuck at a point, I would do my best to explain and get any help

I have a pay period Start date and End Date this can be any period

When I enter the period as (in mm/dd/yyyy format)

Start date "04/08/2010"
End Date "05/08/2010"

then I add 1 month to a calendar handler.add(Calendar.Month,1)

the next and the corresponding dates are

Start date "05/08/2010"
End Date "06/08/2010"

Start date "06/08/2010"
End Date "07/08/2010"

corresponding as desired. But the moment I enter the start date and end date as
as

Start date "04/01/2010"
End Date "04/30/2010" which is a 1 Month period and then add 1 Month to the code
the corresponding dates are

Start date "05/01/2010"
End Date "05/30/2010"

Start date "06/01/2010"
End Date "06/30/2010" [ Even though it has 31 days in June, then from Feb 2011 its like


Start date 01/01/2011
End Date 01/30/2011

Start date 02/01/2011
End date 02/28/2011

Start date 03/01/2011
Start date 03/28/2011

everything ends on the 28th

Can any one let me know why in my first condition the 31st day was being taken care of and in the next condition I am not getting the same output.


Details 04/01/2011 04/28/2011


 
Sheriff
Posts: 67645
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please read this for more information.
    Bookmark Topic Watch Topic
  • New Topic