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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Question, Return Last Friday of any given year

Status
Not open for further replies.

krymat

Technical User
Jul 25, 2000
105
Let's say for example I use 1999 I need to return the date "12/31/1999" with is the last Friday of the year...

Thanks for your help
 
DateValue("12/31/" & [Year])-Weekday(DateValue("12/31/" & [Year]),6)+1
 
I couldn't quite get Albywalt's soloution to work.

This appears to do the 'right stuff'

? DateAdd("d", - 1 * (WeekDay("12/31" & "/" & Trim(str(Yr))) + 1), "12/31" & "/" & Trim(str(Yr)))


MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Slight modification to Michael's code. When I cut and pasted into the debug window on 1/12/01 I got 12/29/00 or last year's date. When I slightly modified it to use the Year(Date) function it worked fine. I also verified it was a Friday.

? DateAdd("d", - 1 * (WeekDay("12/31" & "/" & Trim(str(Year(Date)))) + 1), "12/31" & "/" & Trim(str(Year(Date))))
12/28/01
12/29/00
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top