MaximusMeridus
asked on
Date filter..asp
Hi all,
How do I display the date of the last friday of this month
ie I want to show the date of the last friday for this month
in the following format.
27 August
If we roll on into September then the last friday will be
24 September
Many thanks
How do I display the date of the last friday of this month
ie I want to show the date of the last friday for this month
in the following format.
27 August
If we roll on into September then the last friday will be
24 September
Many thanks
ASKER
Hi Gary,
I am getting the following error
Error Type:
Microsoft VBScript runtime (0x800A001C)
Out of stack space: 'getFriday'
I am getting the following error
Error Type:
Microsoft VBScript runtime (0x800A001C)
Out of stack space: 'getFriday'
<%
response.write getFriday("12/12/04")
function getFriday(strdate)
olddate=dateadd("m",1,strd
tmpdate= year(olddate) & "/" & month(olddate) & "/" & "1"
for count=1 to 7
tmpdate=dateadd("d",-count
if instr(formatdatetime(tmpda
next
getFriday=formatdatetime(t
end function
%>
ASKER
This gives me
04 December 2004
I need the last friday of the current month. which ever the current may be
ie current month is August
therefore
last friday falls on
27 August
04 December 2004
I need the last friday of the current month. which ever the current may be
ie current month is August
therefore
last friday falls on
27 August
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It may be getting confused over the date format, try passing the date in format yyyy/mm/dd
MaximusMeridus - what is your date format? (mm/dd/yyyy, dd/mm/yyyy, yyyy/mm/dd)?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here you go:
<%
BaseDate = date
EndOfMonth = DateSerial(Year(BaseDate), Month(BaseDate) + 1, 0)
for x=0 to 6
EndOfMonth=EndOfMonth-1
if WeekDayName(WeekDay(EndOfM onth)) = "Friday" then
response.write EndOfMonth
end if
next
%>
Barry62
<%
BaseDate = date
EndOfMonth = DateSerial(Year(BaseDate),
for x=0 to 6
EndOfMonth=EndOfMonth-1
if WeekDayName(WeekDay(EndOfM
response.write EndOfMonth
end if
next
%>
Barry62
Any luck with my function?
response.write getFriday("12/11/04")
function getFriday(strdate)
for count=1 to 7
tmpdate=month(strdate)+1 & "/" & 1 & "/" & year(strdate)
tmpdate=dateadd("d",-count
if instr(formatdatetime(tmpda
next
getFriday formatdatetime(tmpdate,1)
end function
%>