![]() ![]() Well, you think that it is correct that one single week has two week numbers?ĭo you know about iso 8601? Look at this: WeekNumbers.Location = New Point(Width - 247, 50) Protected Overrides Sub OnSizeChanged(e As System.EventArgs) ![]() Protected Overrides Sub OnDateChanged(drevent As ) Loop While FirstWeek.DayOfWeek DayOfWeek.ThursdayĮlseIf FirstWeek.DayOfWeek DayOfWeek.Thursdayĭim WeekNumber As Integer = DatePart(DateInterval.WeekOfYear, FirstWeek,, FirstWeekOfYear.FirstFourDays)Į.Graphics.DrawString(WeekNumber.ToString, Font, Brushes.Black, 2, Y) If FirstWeek.DayOfWeek = DayOfWeek.Sunday OrElse FirstWeek.DayOfWeek > DayOfWeek.Thursday Then If FirstWeek.DayOfWeek = DayOfWeek.Monday Then ![]() Private Sub WeekNumbers_Paint(sender As Object, e As ) Handles WeekNumbers.Paintĭim FirstWeek As New Date(SelectionStart.Year, SelectionStart.Month, 1) Private WithEvents WeekNumbers As New Control With However I haven't verified that it is accurate in all cases and so offer it as an idea only and not as fully tested code. I couldn't find any way to make the MonthCalendar use a different method to calculate the week number so I came up with this control which is a bit of a hack but appears to work ok. MsgBox(d.ToString("dddd dd MMM yyyy") & " is week number: " & _ HaveĪ look at the following code for an example: Dim d As New Date(2018, 12, 30) This appeared to work ok in 2006 but I have just been looking at it again and it appears flawed. The DatePart function provides a way to determine the week number for any date with an overload which claims to do so in accordance with ISO 8601. Your own posts is not considered good forum are quite right - there is a problem.ĭiscussion about this many years ago and it became clear that there are several ways of looking at week number, some of which involve having weeks with less than 7 days. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |