Archive

Archive for September, 2009

Date handy fundtions

September 6th, 2009 Comments off

This is a very small thing, but sometimes it helps. I had a date and then I had to find the starting and end date of that month. Here how you can do this small thing in VB .Net. In this case ‘day’ is the date. 

Dim startDate As Date = Date.Parse(“01/” + day.Month.ToString() + “/” + day.Year.ToString())
Dim endDate As Date = startDate.AddMonths(1)
endDate = endDate.AddDays(-1)

you can also use the available functions AddYears and AddMonths.

Cheers

Categories: .Net Tags: , , ,