Get an integer between dates

I am programming in C #, and I have a question: how can I get an integer value between a date. for example: 12/6/2010 and 12/18/2010 how can I get the 1st i = 6, and in the second i = 18

+3
source share
4 answers
DateTime dt = DateTime.Parse("12/6/2010");
int i = dt.Day;

See: DateTime Link

+4
source

It's not clear what you're asking for, but you can access the day from a DateTime as follows:

DateTime dt=DateTime.Now;
int day=dt.Day;

If you want the time difference in days:

DateTime dt1=new DateTime(2010,12,6);
DateTime dt2=new DateTime(2010,12,18);
int dayDelta=(dt2-dt1).Days;
0
source

DateTime (, ). birth.Month, , birth.Day, ..

0

"" DateTime.

0

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


All Articles