Get the number of weeks from today

I have a date in the future, and I want to find out how many weeks this happens.

+3
source share
2 answers
(futureDate - DateTime.Today).TotalDays / 7
+6
source

I think you better spend the days and divide it by 7

DateTime start = DateTime.Now;
DateTime end = DateTime.Now.AddDays(21);

double noOfDays = (end - start).TotalDays;
double noOfWeeks = noOfDays  / 7;
+1
source

Source: https://habr.com/ru/post/1735804/


All Articles