Given any date, find the last date of the week in

Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 32
Given a date like "9/23/2016", find the last date of the week. The below code will do so

Imports System.Globalization

Namespace ConsoleApplication2
Class Program
Private Shared Sub Main(args As String())
Dim initialDate = Convert.ToDateTime("9/23/2016")
Dim lastDayOfWeek = initialDate.AddDays(CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek - initialDate.DayOfWeek).AddDays(6)

End Sub

End Class
End Namespace

Comments or Responses

Login to post response