![](http://habrastorage.org/getpro/habr/avatars/1df/224/95b/1df22495b86f49f6c33416827c818ae0.jpg)
The Russian army through the eyes of an IT-person. How to measure experience?
From childhood it seemed to me (maybe because my grandfather was a military man? ..) that the army is such a place where everything is clearly defined. But upon closer inspection, it turned out to be completely different. Bureaucratic officials rest compared to army commanders. And then I was given one task, which is very important when calculating the salary of military personnel - you need to calculate the length of service accurate to the day. But to the question - how to count his exact answer, no one could give me! And what are the options?
While a person has one period of service, everything is fine. We honestly subtract years from years, months from months, and days from days. Those. if he came to serve on February 5, 1979, and retired on June 10, 1983, then his experience is 4 years 4 months and 6 days.
And what 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 in the second. How much it? I can offer 3 correct answer options:
- 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” January to 31 days and in March there are still 28 worked days. In the second case, for the month we take the average month of 30 days ((int) 365/12 == 30). But the third option has the right to life. Take a look. We believe that a person entered the service on 01.01.2001. And we consider his experience from that moment. So, the years / months / days should go accordingly. Those. he served 59 days from 01/01/2001., and this is similar to what he would have served from 01/01/2001 to 02/28/2001, i.e. 2 months. So the third answer is also correct.
And then how to count?
As a result, I wrote a small program that counts years / months / days fairly for each period, and then beats “extra days” for months from the calculation of one month = 30 days. What do you think, which option is more correct?
PS By the way, I consider the third option to be the most correct - to calculate the total number of days in all periods and postpone them from the very first date of the very first period. But the local authorities do not really agree with this.
While a person has one period of service, everything is fine. We honestly subtract years from years, months from months, and days from days. Those. if he came to serve on February 5, 1979, and retired on June 10, 1983, then his experience is 4 years 4 months and 6 days.
And what 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 in the second. How much it? I can offer 3 correct answer options:
- 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” January to 31 days and in March there are still 28 worked days. In the second case, for the month we take the average month of 30 days ((int) 365/12 == 30). But the third option has the right to life. Take a look. We believe that a person entered the service on 01.01.2001. And we consider his experience from that moment. So, the years / months / days should go accordingly. Those. he served 59 days from 01/01/2001., and this is similar to what he would have served from 01/01/2001 to 02/28/2001, i.e. 2 months. So the third answer is also correct.
And then how to count?
As a result, I wrote a small program that counts years / months / days fairly for each period, and then beats “extra days” for months from the calculation of one month = 30 days. What do you think, which option is more correct?
PS By the way, I consider the third option to be the most correct - to calculate the total number of days in all periods and postpone them from the very first date of the very first period. But the local authorities do not really agree with this.