How to get the Week number, First, and last day for the given date

Hi @K_GOWTHAM

This expression will get the Week Number in Integer

CInt(System.Globalization.CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(New Datetime(2023,10,18),System.Globalization.CalendarWeekRule.FirstDay,DayOfWeek.Sunday).ToString)

First Date of the week

New dateTime(Now.Year,1,1).AddDays(7*(CInt(System.Globalization.CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(New Datetime(2023,10,18),System.Globalization.CalendarWeekRule.FirstDay,DayOfWeek.Sunday).ToString)-1)-CInt(New dateTime(Now.Year,1,1).DayOfWeek)+1)

Last date of the Week

New dateTime(Now.Year,1,1).AddDays(7*(CInt(System.Globalization.CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(New Datetime(2023,10,18),System.Globalization.CalendarWeekRule.FirstDay,DayOfWeek.Sunday).ToString)-1)+7-CInt(New dateTime(Now.Year,1,1).DayOfWeek))

image

Kindly find the video link

Regards
Gokul

2 Likes