<!--
{
  "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(_:)-7ledy",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s8DurationV12millisecondsyABSdFZ"
  },
  "title" : "milliseconds(_:)"
}
-->

# milliseconds(_:)

Construct a `Duration` given a number of seconds milliseconds as a
`Double` by converting the value into the closest attosecond scale value.

```
static func milliseconds(_ milliseconds: Double) -> Duration
```

## Return Value

A `Duration` representing a given number of milliseconds.

## Discussion

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

---

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)