c# - Most efficient way to count number of weeks between two datetimes -
exactly says on tin, need efficient way of counting weeks (i.e. 7-day spans, not calendar weeks) between 2 dates in c#.
get number of days , divide 7.
int weeks = (date1 - date2).totaldays / 7;
you may have remainder of 6 days not included in number of weeks.
Comments
Post a Comment