README.md

December 5, 2022 ยท View on GitHub

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.

More Info

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)%>

A date.

Submitted On
ByJoe McDonnell
LevelAdvanced
User Rating3.7 (11 globes from 3 users)
CompatibilityASP (Active Server Pages), VbScript (browser/client side)

Category |Math World |ASP / VbScript Archive File |

Source 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