{"route":"/en-US-v0.13.1/reference/foundations/duration/","title":"Duration","description":"Documentation for the Duration type.","part":null,"outline":[{"id":"summary","name":"Summary","children":[]},{"id":"constructor","name":"Constructor","children":[{"id":"constructor-seconds","name":"seconds","children":[]},{"id":"constructor-minutes","name":"minutes","children":[]},{"id":"constructor-hours","name":"hours","children":[]},{"id":"constructor-days","name":"days","children":[]},{"id":"constructor-weeks","name":"weeks","children":[]}]},{"id":"definitions","name":"Definitions","children":[{"id":"definitions-seconds","name":"Seconds","children":[]},{"id":"definitions-minutes","name":"Minutes","children":[]},{"id":"definitions-hours","name":"Hours","children":[]},{"id":"definitions-days","name":"Days","children":[]},{"id":"definitions-weeks","name":"Weeks","children":[]}]}],"body":{"kind":"type","content":{"name":"duration","title":"Duration","keywords":[],"oneliner":"Represents a positive or negative span of time.","details":"<p>Represents a positive or negative span of time.</p>","constructor":{"path":[],"name":"duration","title":"Construct","keywords":[],"oneliner":"Creates a new duration.","element":false,"contextual":false,"deprecation":null,"details":"<p>Creates a new duration.</p>\n<p>You can specify the <a href=\"/en-US-v0.13.1/reference/foundations/duration/\" title=\"duration\">duration</a> using weeks, days, hours, minutes and\nseconds. You can also get a duration by subtracting two\n<a href=\"/en-US-v0.13.1/reference/foundations/datetime/\">datetimes</a>.</p>","example":"<div class=\"previewed-code\"><pre><code><span class=\"typ-func\">#</span><span class=\"typ-func\">duration</span><span class=\"typ-punct\">(</span>\n  days<span class=\"typ-punct\">:</span> <span class=\"typ-num\">3</span><span class=\"typ-punct\">,</span>\n  hours<span class=\"typ-punct\">:</span> <span class=\"typ-num\">12</span><span class=\"typ-punct\">,</span>\n<span class=\"typ-punct\">)</span><span class=\"typ-punct\">.</span><span class=\"typ-func\">hours</span><span class=\"typ-punct\">(</span><span class=\"typ-punct\">)</span>\n</code></pre><div class=\"preview\"><img src=\"/en-US-v0.13.1/assets/1a61bd24ab10644a9c59709ce7688889.png\" alt=\"Preview\"></div></div>","self":false,"params":[{"name":"seconds","details":"<p>The number of seconds.</p>","example":null,"types":["int"],"strings":[],"default":"<code><span class=\"typ-num\">0</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"minutes","details":"<p>The number of minutes.</p>","example":null,"types":["int"],"strings":[],"default":"<code><span class=\"typ-num\">0</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"hours","details":"<p>The number of hours.</p>","example":null,"types":["int"],"strings":[],"default":"<code><span class=\"typ-num\">0</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"days","details":"<p>The number of days.</p>","example":null,"types":["int"],"strings":[],"default":"<code><span class=\"typ-num\">0</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false},{"name":"weeks","details":"<p>The number of weeks.</p>","example":null,"types":["int"],"strings":[],"default":"<code><span class=\"typ-num\">0</span></code>","positional":false,"named":true,"required":false,"variadic":false,"settable":false}],"returns":["duration"],"scope":[]},"scope":[{"path":["duration"],"name":"seconds","title":"Seconds","keywords":[],"oneliner":"The duration expressed in seconds.","element":false,"contextual":false,"deprecation":null,"details":"<p>The duration expressed in seconds.</p>\n<p>This function returns the total duration represented in seconds as a\nfloating-point number rather than the second component of the duration.</p>","example":null,"self":true,"params":[],"returns":["float"],"scope":[]},{"path":["duration"],"name":"minutes","title":"Minutes","keywords":[],"oneliner":"The duration expressed in minutes.","element":false,"contextual":false,"deprecation":null,"details":"<p>The duration expressed in minutes.</p>\n<p>This function returns the total duration represented in minutes as a\nfloating-point number rather than the second component of the duration.</p>","example":null,"self":true,"params":[],"returns":["float"],"scope":[]},{"path":["duration"],"name":"hours","title":"Hours","keywords":[],"oneliner":"The duration expressed in hours.","element":false,"contextual":false,"deprecation":null,"details":"<p>The duration expressed in hours.</p>\n<p>This function returns the total duration represented in hours as a\nfloating-point number rather than the second component of the duration.</p>","example":null,"self":true,"params":[],"returns":["float"],"scope":[]},{"path":["duration"],"name":"days","title":"Days","keywords":[],"oneliner":"The duration expressed in days.","element":false,"contextual":false,"deprecation":null,"details":"<p>The duration expressed in days.</p>\n<p>This function returns the total duration represented in days as a\nfloating-point number rather than the second component of the duration.</p>","example":null,"self":true,"params":[],"returns":["float"],"scope":[]},{"path":["duration"],"name":"weeks","title":"Weeks","keywords":[],"oneliner":"The duration expressed in weeks.","element":false,"contextual":false,"deprecation":null,"details":"<p>The duration expressed in weeks.</p>\n<p>This function returns the total duration represented in weeks as a\nfloating-point number rather than the second component of the duration.</p>","example":null,"self":true,"params":[],"returns":["float"],"scope":[]}]}}}