VB icon

Week Ending Date

Email
Submitted on: 1/5/2015 3:30:00 PM
By: Joe McDonnell (from psc cd)  
Level: Advanced
User Rating: By 3 Users
Compatibility: ASP (Active Server Pages), VbScript (browser/client side)
Views: 1511
 
     Returns the date of the week-ending day based on the input date. Useful for due-by dates, weekly accounts etc.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Week Ending Date
' Description:Returns the date of the week-ending day based on the input date. Useful for due-by dates, weekly accounts etc.
' By: Joe McDonnell (from psc cd)
'
' 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.
'**************************************

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


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.