c# - Manipulate DateTime using Linq -
i have solution table in database , want display solutions less day old of now(datetime.now) thank
iqueryable<solution> solutions= x in db.solutions x.created_at == datetime.now -1 select x;
use datetime.adddays
target date. use >=
comparison filter solutions less old target date (or equal it):
iqueryable<solution> solutions = s in db.solutions s.created_at >= datetime.now.adddays(-1) select s;
note: give entities withing 24 hours now. if want entities beginning of yesterday, use datetime.today
instead of datetime.now
.
Comments
Post a Comment