Skip to main content
Deno 2 is finally here 🎉️
Learn more
Very Popular
Latest
function default
import { default } from "https://deno.land/x/date_fns@v2.22.1/monthsToYears/index.ts";

Examples

// Convert 36 months to years: const result = monthsToYears(36) //=> 3

// It uses floor rounding: const result = monthsToYears(40) //=> 3

Parameters

months: number
  • number of months to be converted

Returns

number

the number of months converted in years