c# - how to get day of the week only if entered date is falling between last monday -



c# - how to get day of the week only if entered date is falling between last monday -

i trying day of week if entered date falling between lastly mon current date i.e if today 30/10/14 output should th else show date entered here trying

datetime aa = convert.todatetime(rr.detail); if (datetime.now.subtract(aa).days < 7) { // not looking want if aa // falling between lastly mon , less 7 days }

so thought how accomplish it?

if understand correctly, steps i'd take are:

1) date of previous monday

2) user's date

3) check if user's date after previous mon (in case show day)

//get date of previous mon datetime prevmonday = datetime.now; while(prevmonday.dayofweek != dayofweek.monday) prevmonday = prevmonday.adddays(-1); //get user's date datetime aa = convert.todatetime(rr.detail); //check if user's date after mon if (aa > prevmonday && aa <= datetime.now.date) console.writeline(aa.dayofweek); else console.writeline(aa);

c# date

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -