• Post Reply Bookmark Topic Watch Topic
  • New Topic

previous quarter  RSS feed

 
rahul saxena
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any method which returns previous quarter by giving todays date?
thanks in advance.
 
Sebastiaan Kortleven
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • 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 ]
 
Tom Blough
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • 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
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!