• 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

previous quarter

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there any method which returns previous quarter by giving todays date?
thanks in advance.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In what format do you want it?
You could divide the current monthnr by 4, skip the rest and add 1 if you just want a number...
[ March 17, 2004: Message edited by: Sebastiaan Kortleven ]
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sebastiaan Kortleven:
In what format do you want it?
You could divide the current monthnr by 4, skip the rest and add 1 if you just want a number...


Not quite. Dividing by 4 gives one third of a year. Dividing by 3 gives quarters. Still with the above formula, the quarter is wrong for the last month of the quarter (i.e. March becomes the second quarter).
Try this to get the current quarter:

The previous quarter then becomes:

Hope this helps,

Tom Blough
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I had this logic of quarter and fiscal year management in one project but there is no available classes for that so...may be you can create a small library for that
Regards
Maulin
 
reply
    Bookmark Topic Watch Topic
  • New Topic