jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes Calculate Fiscal year Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Calculate Fiscal year" Watch "Calculate Fiscal year" New topic

Calculate Fiscal year

Aryan Khan
Ranch Hand

Joined: Sep 12, 2004
Posts: 290

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?


Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Sounds like you need to implement your own Calendar class.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
bart zagers
Ranch Hand

Joined: Feb 05, 2003
Posts: 234
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.
Casey Buresh

Joined: Oct 03, 2006
Posts: 18
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.

'allo Poppet!!!
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link: http://aspose.com/file-tools
subject: Calculate Fiscal year
It's not a secret anymore!