convert

fnlong convert(string from, string to)(long value) if (((from == "weeks" || from == "days" || from == "hours" || from == "minutes" || from == "seconds" || from == "msecs" || from == "usecs" || from == "hnsecs" || from == "nsecs") && (to == "weeks" || to == "days" || to == "hours" || to == "minutes" || to == "seconds" || to == "msecs" || to == "usecs" || to == "hnsecs" || to == "nsecs")) || ((from == "years" || from == "months") && (to == "years" || to == "months"))) @safe pure nothrow @nogc

Generic way of converting between two time units. Conversions to smaller units use truncating division. Years and months can be converted to each other, small units can be converted to each other, but years and months cannot be converted to or from smaller units (due to the varying number of days in a month or year).

Parameters

fromThe units of time to convert from.
toThe units of time to convert to.
valueThe value to convert.