We had a requirment to run an application for the last day of the month. The following method was helpful to get the date.
Sample Code:
private DateTime GetLastDayofMonth(DateTime dtDate)
{
DateTime dtToDate = dtDate;
dtToDate = dtToDate.AddMonths(1);
dtToDate = dtToDate.AddDays(-(dtToDate.Day));
return dtToDate;
}
{
int intJulianDate = 1000 * (DateTime.Now.AddMonths(-1).Year - 1900) + GetLastDayOfMonth(DateTime.Now.AddMonths(-1)).DayOfYear;
return intJulianDate.ToString();
}
Hope it Helps
Fauzi ~4z