get Quarter value for specific date

  • Thread starter Thread starter martin1
  • Start date Start date
M

martin1

All,

I try to get specific date's quarter value, for eaxmple quarter value is 1
for 02/04/2008, anyone can help this out?

Thanks

Martin
 
martin1 said:
All,

I try to get specific date's quarter value, for eaxmple quarter
value is 1 for 02/04/2008, anyone can help this out?

Dim d As Date = #2/4/2008#
Dim q As Integer

q = (d.Month \ 4) + 1


Armin
 
how about something like
Select Case MyDate.Month
Case 1 to 3
Qtr = 1
Case 4 to 6
Qtr = 2
etc
 
Well, it's not like the quarters change, right? Like suddenly March is
truncated because the U.S. Congress is tired of the whole lion and lamb
thing, so they expand April and start it early? Oh, wait, considering what
they did with Daylight Savings Time in the U.S., they might actually do
something like that. Never mind. ;-)

Can't you just write a function to test the month passed in?

RobinS.
 
Well, our company's fiscal year starts 1 February, while the government's
fiscal year starts 1 October... Periods and quarters are thus based on those
dates.
 
Robin,

When the Pope did it, it would maybe give a change to the Gregorian
calendar, don't overestimate the power of the US Congress. AFAIK do they in
Russia (and more states) still use the Julian calendar because they are not
under the influence from the west European religions. Beside that are
important calendars the Arabic and the Jewish one. The latter is real a
special one with its leap month.

Probably China would nice follow the US congres as for them the Gregorian
calendar is not so long in use, not unlikely that they think that is is
something as Coca Cola.

DayLight saving time is by the way a British invention which now for many
years in the EU (and related states in Europe) starting at the same date in
every state of that.

Cor
 
In that case he would definitely have to hardcode the months!

RobinS.
-------------------
 
LOL.

I'd love to not overestimate the power of the U.S.Congress. But it's also
important not to UNDERestimate the ability of any large governmental body to
do something really stupid that causes widespread problems.

I believe daylight savings time does start and end on the same day in the
U.S. However, I remember reading that at least one of the midwestern states
(Indiana? Michigan?) actually had part of the state NOT do daylight savings
time, and part if it DID, up until a year or so ago. Would you hate to live
there, or what? "Oh, that town 3 miles down the road; it's an hour later
there." Pfffft.

RobinS.
GoldMail, Inc.
 
Not really...
FiscalMonth = ((MyDate.Month + (12 - FiscalYearStartMonth) Mod 12) + 1
FiscalQtr = ((FiscalMonth - 1) \ 3) + 1

So all you really need to know is what is the first month of the fiscal year.
 
Dim dtmCurrentDateTime As System.DateTime = Now()
Dim iCurrentQuarter As System.Int32 = DatePart(DateInterval.Quarter, dtmCurrentDateTime)
 
Back
Top