Since childhood, it seemed to me (maybe because my grandfather was a military man? ..) that the army is a place where everything is clearly defined. But on closer inspection, it turned out to be completely different. Officials bureaucrats rest in comparison with the army commanders. And here I was assigned one task, which is very important when calculating the salaries of servicemen - you need to calculate the work experience with a day. But no one could give the question of how to count it as an exact answer! And what are the options?
While a person has one period of service, all is well. We honestly subtract years from years, months from months, and days from days. Those. if he came to serve on February 5, 1979, and resigned on June 10, 1983, his experience is 4 years 4 months and 6 days.
What to do if he served from 01/01/2001 to 01/29/2001 and from 01/03/2001 to 03/30/2001? He served 29 days in the first period and 30 days in the second. How much it? I can offer 3 correct answers:
- 1 month and 28 days
- 1 month and 29 days
- 2 months
Each of them has a logical explanation. Well, the first two are probably understandable. In the first case, we “finish off” January to 31 days and in March there are still 28 days worked. In the second case in a month, we take an average month in size of 30 days ((int) 365/12 == 30). But the third option has the right to life. See it. We believe that the person entered the service 1.01.2001. And we consider his experience from this very moment. And that means that the year / month / days should go appropriate. Those. he served 59 days from January 1, 2001, and this is similar to what he would serve from January 1, 2001, to February 28, 2001, i.e. 2 months. So the third answer is also correct.
And how then to count?
As a result, I wrote a small program, which for each period counts years / months / days honestly, and then “extra days” beats months from the calculation of one month = 30 days. What do you think, which option is more correct?
PS I, by the way, consider the third option to be the most correct - to count the total number of days in all periods and set them aside from the very first date of the very first period. But the local authorities are not very agree with that.