this is my code which I am going to convert it to vb.net. Please help me out
public IEnumerable<DateTime> GetAllQuarters(DateTime current, DateTime past)
{
var curQ = (int)Math.Ceiling(current.Month / 3.0M);
var lastQEndDate = new DateTime(current.Year, curQ * 3, 1).AddMonths(-2).AddDays(-1);
do
{
yield return lastQEndDate;
lastQEndDate = lastQEndDate.AddMonths(-3);
lastQEndDate = new DateTime(lastQEndDate.Year, lastQEndDate.Month, DateTime.DaysInMonth(lastQEndDate.Year, lastQEndDate.Month));
} while (lastQEndDate >= past);
}
What I have tried:
Public Function GetAllQuarters(current As DateTime, past As DateTime) As IEnumerable(Of DateTime)
Dim curQ = CInt(Math.Ceiling(current.Month / 3D))
Dim lastQEndDate = New DateTime(current.Year, curQ * 3, 1).AddMonths(-2).AddDays(-1)
Do
yield Return lastQEndDate
lastQEndDate = lastQEndDate.AddMonths(-3)
lastQEndDate = New DateTime(lastQEndDate.Year, lastQEndDate.Month, DateTime.DaysInMonth(lastQEndDate.Year, lastQEndDate.Month))
Loop While lastQEndDate >= past
End Function