Let us count the days from 10 to 31
The number of days will be 31 - 10 + 1 = 22 days
The number of days from 1 to 18 = 18 - 1 + 1 = 18 days
Then from 10 January to 31 January, there are 22 days, and
From 1 February to 18 February, there are 18 days
Then from 10 January to 18 February there are 22 + 18 = 40 days
The time is 40 days