Given a date, find the date of the previous Sunday.
Category:Dates and Math
This function uses the intrinsic DatePart and DateSerial functions. Given any date, it will return a Date-type variable containing the date of the Sunday beginning that week. (If the argument passed is a Sunday, _that_ Sunday, not the previous Sunday, will be returned.) Good for programs that organize data by the week, with weeks starting on Sunday.
Instructions: Copy the declarations and code below and paste directly into your VB project.