akim Posted July 9, 2003 Posted July 9, 2003 hi, i need a function to get the number of the week. for example this week is the 29th. can anyone help me?? thx, akim Quote
Moderators Robby Posted July 9, 2003 Moderators Posted July 9, 2003 there may be a better way of doing this, but... 'cal1 is the Calendar control Dim d As Date = CType("1/1/" & DateAndTime.Now.Year.ToString, Date) Dim w As Long = DateDiff(DateInterval.WeekOfYear, d, cal1.SelectionStart.Date) MessageBox.Show(w.ToString) btw, this is week 27 Quote Visit...Bassic Software
akim Posted July 10, 2003 Author Posted July 10, 2003 hi, thx for your answer, i heard that the calender week is different in many countries. in germany at the moment we got the 28 in canada as you said is the 27. so i think i should ask someone in a german forum. akim Quote
Moderators Robby Posted July 10, 2003 Moderators Posted July 10, 2003 I think it may be affected by the day of the week the calendar control starts the week. I started on Sunday. [edit]I tested several days (as the FirstDayOfWeek) I got the same results[/edit] Quote Visit...Bassic Software
Moderators Robby Posted July 10, 2003 Moderators Posted July 10, 2003 Hmm, Select the following dates and see what you get... Here are my results... Jan 1 = 0 Jan 4 = 0 Jan 5 = 1 Jan 11 = 1 Jan 12 = 2 Feb 1 = 4 It seems that my zero should be a one, so your results are accurate. Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.