hi friend,
there is a property (read only) for a datetime variable called "day"
check it and print the date
if(dateToday.Da y=="sunday")
{
print dateToday;
}
this is not code, just i wrote the method
Originally posted by nirmalsingh
hi all!
i have to find the dates of sundays in a year. help me with sample code in C#.
thanx in advance.
hi friend,
there is a property (read only) for a datetime variable called "day"
check it and print the date
if(dateToday.Da y=="sunday")
{
print dateToday;
}
this is not code, just i wrote the method
i am in need of full list of dates that comes in sundays in a year.
this is may not a very good idea but it should work :D
for month = 1 to 12 in year
{
get three first dates of month (1st,2nd,3rd)
if DaysInMonth == 30 and (1stdate == "Sunday" or 2nddate == "Sunday")
Number of Sunday += 5;
else if DaysInMonth == 31 and (1stdate == "Sunday" or 2nddate == "Sunday" or 3rddate == "Sunday")
Number of Sunday += 5;
else
Number of Sunday += 4;
}
Comment