I removed it intentionally, because it is creating some ambiguity in understanding purpose. The result of the same function varies from one country to country.
- Kunal
No No. Most of the times, every one needs quarter of the date for financial results. If a company is declaring its 1st quarter performance means it is for Apr May & Jun, not Jan Feb & Mar. I hope you are clarified.
From financial year point of view, Apr May & Jun are to be treated as 1st quarter. In other areas quarter number is very less important or not at all.
Very few countries use Jan Feb & Mar as 1st quarter.
Go to this link : http://en.wikipedia.org/wiki/Fiscal_year.
Quarter of a date varies from country to country and most of the countries use April May & Jun as 1st quarter.
Whatever the result the function may return, it is wrong to other. One single function will not suffice the requirement. Everybody has to implement their own functionality in this case. I just taken the example for India.
Further, there is not much logic involved in that function. Luc simply cannot say there is a bug in the function. That is why I responded like that.
Ravi, I think Luc here is right. The QuarterOfDate() should return 1,2,3,4 and not 4,1,2,3. Reason behind this is: we need to check the DateTime for English year only [MAX time and MAX of your readers should need it] and for that Jan, Feb, Mar should return 1 whereas Apr should return you 2. Please improve your Tip/Trick with proper code.
All the best.
And yes, there is nothing called "Negative Voting". We always want to share our knowledge here and also want to help others by suggesting them in various ways and Luc did the same thing. Please don't take it in negative way and keep sharing your knowledge here. We want to see more of your tips/articles here. Keep up the good work.
- Luc Pattyn
In India
1st qtr = Apr, May, Jun,
2nd Qtr = Jul, Aug, Sep,
3rd Qtr = Oct, Nov, Dec,
4th Qtr = Jan, Feb, Mar.
If you have found any bug, you would have confirmed the issue with the author. Nobody is such foolish here. At first, I have written the first two functions only. I added the third function only on the request of Kunal Chowdhury who is also an Indian.
You simply spoiled the others interest by voting negatively. I don't mind even if nobody votes. But receiving the things in negative way really bothers.
QuarterOfDate seems quite wrong, it numbers the quarters as 4, 1, 2, 3?
all it takes IMO is return (curDate.Month+2)/3; if one wants quarters 1, 2, 3, 4.