• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calculate Fiscal year

 
Ranch Hand
Posts: 290
Oracle Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to set the start of year to a different date than 01/01/.
Lets say I want to set the start date of the year to 23-02.
I want the java calendar classes to return the fields e.g week days, month etc according to this new date.for example Calendar.get(Calendar.MONTH)) for above date should return 0 as it is the first month of my fiscal year.

Is there any way to set this?

Thanks
Ahmad
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like you need to implement your own Calendar class.
 
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Sturrock:
Sounds like you need to implement your own Calendar class.



Sounds like you should take a look at Joda-Time, to see how it can help you.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you doing this for? Why not just use Math.random() to random numbers between 1 and 12 then have if else statements to set it so like if it comes up with 2 then the second Math.random() is only going to go between 1 and 28 or however many days there are in February. Unless you need to set something as a new date permanentaly then just do what others said.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See if packages like Time And Money or Joda Time do what you need. Or just google for Java Fiscal Year and see what pops up.
reply
    Bookmark Topic Watch Topic
  • New Topic