Search Tools Links Login

Week Ending Date


Returns the date of the week-ending day based on the input date. Useful for due-by dates, weekly accounts etc.

Original Author: Joe McDonnell

Inputs

A date, or use date() for the current date.
The number of the week-ending day (Sun=1 ... Sat=7).
Example: myvalue=<%=weekendday(date(),1)%>

Returns

A date.

Code

This function accepts the input date and the weekending day (Sun=1.....Sat=7).
If the weekday of the input date is the same as the weekending day it returns the input date
Function weekendday(inputdate, day)
If Weekday(inputdate) > day Then
inputdate = inputdate + 7
End If
weekendday = inputdate + (day - Weekday(inputdate))
End Function

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 92 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.