In an interview, take advantage of the fact that you are not filling out a form online, or writing up a resume to a strict format. You are talking to a human. So answer in an honest, complete, and useful way.
For example
It's been more than 5 years since I started using X, so I've certainly seen the changes in it and watched it improve. I don't want to suggest I used it 8 hours a day for those 5 years, of course. The first few years I would have some projects that used it and some that didn't. The last year I have been using it pretty continuously and overall I feel comfortable saying I have 5 years experience with it.
This starts with a fact, wanders through details, and winds up with a claim that is pretty strongly backed by the details. (Some interviewers only listen to the first and last sentence fragments of long answers.) You'll not feel that you're lying, but you won't be throwing away your own useful experience by calculating it too granularly. I mean doing that math and deciding you only have 2 years experience just isn't true. Maybe "the equivalent of" but when I hear that I think the person is inflating their experience, not deflating it to account for skipped times.
I've been using C++ since roughly 1987. I didn't record the precise date because I didn't know it was going to be important. It might have been 1986, I don't know. There have been times in those 30 years that I didn't do much or even any C++ for months at a time or even longer. I don't care. I have 30 years of C++ experience. I think it would be good for you to adopt a similar attitude.