Get records in particular date range
Posted
by developer
on Stack Overflow
See other posts from Stack Overflow
or by developer
Published on 2010-04-26T16:36:49Z
Indexed on
2010/04/26
16:43 UTC
Read the original article
Hit count: 116
c#
Hi All, I have a column in database that shows DateCreated. Now I want to filter records depending on the date range selected. Eg, Created within 60 days, created withing year, etc. I have a variable dateCreated that shows me what the user has selected as the range.i.e., whether it is Created within 60 days, created withing year.
if (datecreated == "Created within 60 days")
{
DateTime CurrTime = DateTime.Now;
if (prg.Subscriber.Username == CurrentUsername && prg.Program.DateCreated<=DateTime.Now - 60)
{
UserPrgList.Add(new ProgramSubscriptionViewModel(prg));
}
}
But the above code wont work..what would be the syntax to get the records within a particular range??
© Stack Overflow or respective owner