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

Popular posts from this blog

Ansible warning on jinja2 braces on when -

Parsing a protocol message from Go by Java -

html - How to custom Bootstrap grid height? -