c# - Calculating for remaining days in current month -
this question has answer here:
i know how calculate remaining days of month e.g (15 feb 2017 28 feb 2017) without use of datetimepicker set @ 28 feb 2017.
here codes subtraction of 2 datetimepicker:
datetime startdate = (datetime)datetimepicker2.value; datetime enddate = (datetime)datetimepicker1.value; timespan ts = enddate.subtract(startdate); textbox10.text = ts.days.tostring();`
here steps need go through:
- take current date
- use datetime.addmonths() generate new date 1 month current date
- create new date uses 1 day, , month , year future date worked out
- subtract current date future date, give timespan contains number of days difference
you can use closely related question calculate difference between 2 dates (number of days)? guide.
Comments
Post a Comment