[VB.net] How to return calendar week from a date

This is a method how to calculate the calendar week from a date:


Imports System.Globalization
Public Function getCalendarWeek(ByVal Datum As Date) As Short
Dim CUI As New CultureInfo (CultureInfo.CurrentCulture.Name)
Return CUI.Calendar.GetWeekOfYear(Datum,_
CUI.DateTimeFormat.CalendarWeekRule,_
CUI.DateTimeFormat.FirstDayOfWeek)
End Function

Leave a Reply

Your email address will not be published.