Back when I was doing lots of software developer interviews, one of my
frequent questions involved date math. This wasn't because it's
difficult from a coding standpoint, but that it's NOT a coding problem.
The key part of the question is realization that it's a requirements
question. The thing that makes dates complicated is defining what the
question actually is.
The topic _seems_ like it should be simple, but the deeper you dig the
more you realize it's anything but simple.
On 2/10/2024 7:53 AM, Alexander Zhirov via Digitalmars-d-learn wrote:
Is it possible to calculate the difference between dates in years using
regular means? Something like that
```
writeln(Date(1999, 3, 1).diffMonths(Date(1999, 1, 1)));
```
At the same time, keep in mind that the month and day matter, because
the difference between the year, taking into account the month that has
not come, will be less.
My abilities are not yet enough to figure it out more elegantly.