<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/Duration/milliseconds(_:)-1w328",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s8DurationV12millisecondsyABxSzRzlFZ"
  },
  "title" : "milliseconds(_:)"
}
-->

# milliseconds(_:)

Construct a `Duration` given a number of milliseconds represented as a
`BinaryInteger`.

```
static func milliseconds<T>(_ milliseconds: T) -> Duration where T : BinaryInteger
```

## Return Value

A `Duration` representing a given number of milliseconds.

## Discussion

```
  let d: Duration = .milliseconds(645)
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)