Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Dates

Status
Not open for further replies.

dvannoy

MIS
May 4, 2001
2,765
US
I'm getting the week number using the following;

t3.Text = DatePart(DateInterval.WeekOfYear, myDate, FirstDayOfWeek.Monday, FirstWeekOfYear.System)

Now, I have 6 labels that I need to fill in the dates based on the week selected. so, Monday- Sat so if the user selects week 51, I need the below labels to show the monday - Sat dates of that week.

lm =
lt =
lw =
lth =
lf =
lf =

any help would be appreciated.

thanks

 
Since you have "myDate", I assume that is a date in the desired week. You would not have to then get the week number, just get the day in the week that you desire

Code:
Public Function GetDayOfWeekFromDate(DateInWeek As Date, DesiredDay As DayOfWeek)
  Return DateInWeek.AddDays(DesiredDay - Weekday(DateInWeek) + 1)
 End Function
ex
GetDayOfWeek(myDate,Dayofweek.sunday)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top