Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Week of year for a custom Fiscal Year 1

Status
Not open for further replies.

Ausburgh

Programmer
Jul 21, 2004
62
US
I’m trying create a function to get the “percentage of Fiscal Year elapsed” for a fiscal year that started and ends on 10/1/05 and 9/30/06 respectively.

How do I determine: Format "ww" returns week of year (1-53) for a year that starts and ends September and August respectively.

Thanks in advance
 
>that starts and ends September and August respectively.

Based on the given dates, I think you want to say October (1) and September (30) above.

Try the following function.
___
[tt]
Function GetFiscalYearPercent(Dt As Date) As Single
Dim Dt1 As Date, Y As Long
Y = Year(Dt)
If Month(Dt) < 10 Then Y = Y - 1
Dt1 = DateSerial(Y, 10, 1)
GetFiscalYearPercent = Round((Dt - Dt1) / (DateAdd("YYYY", 1, Dt1) - Dt1) * 100, 2)
End Function

Private Sub Form_Load()
MsgBox GetFiscalYearPercent(Date)
End Sub[/tt]
 
Hypetia,

You sir are my hero.

I was too busy confusing myself with:

Public Overloads Function DatePart(ByVal Interval As DateInterval,ByVal DateValue As DateTime, _
Optional ByVal FirstDayOfWeekValue As FirstDayOfWeek = VbSunday, _
Optional ByVal FirstWeekOfYearValue As FirstWeekOfYear = VbFirstJan1) As Integer


Thank you very much - I REALLY appreciate it.
 
Great that you've found the answer in the VB6 forum. I suspect that you may actually be in the wrong forum entirely if you are looking at
ausburgh said:
Public Overloads Function DatePart......
which looks like .NET stuff and should probably be in forum796

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
johnwm,

I came across that when I was researching and that's why I said I was confusing myself.

I'm a VB 6.0 beginner
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top