c# - linq: check if there are entries from the same day or week in a particular table -
so want number of entries in database form selected date , week day in. both database column , variable datetime fields. method date is:
private int multiuse_timesinaday() { daydate date = currentdate.date; var submitcount = campaignmessages in dccrdata.mytable campaignmessages.created == date select campaignmessages; int count = submitcount.count(); return count; }
and i'm kinda lost on how week search. ideas?
//first last monday i.e. start of week int delta = dayofweek.monday - currentdate.date.dayofweek; datetime monday = currentdate.date.adddays(delta); var submitcount = campaignmessages in dccrdata.mytable campaignmessages.created >= monday && campaignmessages.created <= monday.adddays(7) select campaignmessages;
Comments
Post a Comment