The quest to destroy the One Ring took approximately 17 months (Third Age 3018–3019). Timeline:
Rivendell to Mount Doom ≈ 15 months; including pre-Moria travel ≈ 17 months. Exact Moria duration isn't specified, and the route was indirect, so this is an estimate based on Tolkien's dates.