hokiewalrus
Registered User.
- Local time
- Today, 08:37
- Joined
- Jan 19, 2009
- Messages
- 50
I've been developing a payroll problem recently and it started blowing up when it was 2009 but the next payroll ending date was in 2010.
I abandoned what I was using (it had other problems) and recently went to the DateSerial function, but I feel like it will have the same problem:
Since it's basically hard-coding the year to be the same as the ProvidedDate (which is usually just the current date). Is there a way that works when you have to span 2 years?
I abandoned what I was using (it had other problems) and recently went to the DateSerial function, but I feel like it will have the same problem:
Code:
Public Function GetWeekEndDate(ProvidedDate As Date) As Date
GetWeekEndDate = DateSerial(Year(ProvidedDate), Month(ProvidedDate), Day(ProvidedDate) + (4 - Weekday(ProvidedDate)))
End Function
Since it's basically hard-coding the year to be the same as the ProvidedDate (which is usually just the current date). Is there a way that works when you have to span 2 years?