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

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -