[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2019-12-13 UTC."],[],[],null,["# Namespace: duration\n\n[rules](/docs/reference/rules/rules).duration\n=============================================\n\nnamespace static\n\nGlobally available duration functions. These functions are accessed using the\n`duration.` prefix.\n\nMethods\n-------\n\n### abs\n\nstatic\n\nabs(duration) returns [rules.Duration](/docs/reference/rules/rules.Duration)\n\nAbsolute value of a duration.\n\n| #### Parameter ||\n|----------|------------------------------------------------------------------------------------------------|\n| duration | [rules.Duration](/docs/reference/rules/rules.Duration) Duration value. Value must not be null. |\n\nReturns\n\n: `non-null `[rules.Duration](/docs/reference/rules/rules.Duration) the absolute duration value of the input.\n\n#### Example\n\n duration.abs(duration.value(-10, 's')) == duration.value(10, 's')\n\n### time\n\nstatic\n\ntime(hours, mins, secs, nanos) returns [rules.Duration](/docs/reference/rules/rules.Duration)\n\nCreate a duration from hours, minutes, seconds, and nanoseconds.\n\n| #### Parameter ||\n|-------|-------------------------------------------------------------------------------------------------------------------|\n| hours | [rules.Integer](/docs/reference/rules/rules.Integer) Hours portion of the duration. Value must not be null. |\n| mins | [rules.Integer](/docs/reference/rules/rules.Integer) Minutes portion of the duration. Value must not be null. |\n| secs | [rules.Integer](/docs/reference/rules/rules.Integer) Seconds portion of the duration. Value must not be null. |\n| nanos | [rules.Integer](/docs/reference/rules/rules.Integer) Nanoseconds portion of the duration. Value must not be null. |\n\nReturns\n\n: `non-null `[rules.Duration](/docs/reference/rules/rules.Duration) a Duration.\n\n### value\n\nstatic\n\nvalue(magnitude, unit) returns [rules.Duration](/docs/reference/rules/rules.Duration)\n\nCreate a duration from a numeric magnitude and string unit.\n\n*** ** * ** ***\n\n| Unit | Description |\n|------|--------------|\n| w | Weeks |\n| d | Days |\n| h | Hours |\n| m | Minutes |\n| s | Seconds |\n| ms | Milliseconds |\n| ns | Nanoseconds |\n\n| #### Parameter ||\n|-----------|------------------------------------------------------------------------------------------------------------------|\n| magnitude | [rules.Integer](/docs/reference/rules/rules.Integer) Unitless magnitude of the duration. Value must not be null. |\n| unit | [rules.String](/docs/reference/rules/rules.String) Unit of the duration. Value must not be null. |\n\nReturns\n\n: `non-null `[rules.Duration](/docs/reference/rules/rules.Duration) a Duration.\n\n#### Example\n\n duration.value(1, 'w') // Create a duration for 1 week of time."]]