The requirement is if Filedropdate < 14 then I hav to have fileactivedatetime as that mothfirstday else next month first date.ie
if Filedropdate = 12/7/2010 ( as day is less than 14 ) then fileactivedatetime should be 01/7/2010
if Filedropdate = 17/7/2010 ( as day is greater than 14 ) then fileactivedatetime should be 01/8/2010
Please provide a solution.
Loading
Hirendra SisodiyaPosted Jul 8, 2010, 11:25 AM
Try this code:
int TempDate = Filedropdate.Day;
int TempMonth = Filedropdate.Month;
int Tempyear = Filedropdate.Year;
if (TempDate < 14)
{
Filedropdate = new DateTime(Tempyear, TempMonth, 1);
}
else
{
if (TempMonth == 12)
{
Filedropdate = new DateTime(Tempyear+1, 1, 1);
}
else
{
Filedropdate = new DateTime(Tempyear, TempMonth + 1, 1);
}
}
thanks
Please mark as answer if it helps