# Get Unit of Time

URL: https://caijiao.org/dayjs/durations/get
Source: docs/dayjs/durations/get.md
Description: 可以使用 'get' 方法获取时长的特定单位值。

作为 `Duration#x()` 获取器的替代，可以使用 `Duration#get('x')`。

```javascript
var duration = dayjs.duration;

duration.get("hours");
duration.get("minutes");
duration.get("seconds");
duration.get("milliseconds");
```

## 支持的单位列表

<table>
<thead>
<tr><th>单位</th><th>缩写</th></tr>
</thead>
<tbody>
<tr><td><code>days</code></td><td><code>d</code></td></tr>
<tr><td><code>weeks</code></td><td><code>w</code></td></tr>
<tr><td><code>months</code></td><td><code>M</code></td></tr>
<tr><td><code>years</code></td><td><code>y</code></td></tr>
<tr><td><code>hours</code></td><td><code>h</code></td></tr>
<tr><td><code>minutes</code></td><td><code>m</code></td></tr>
<tr><td><code>seconds</code></td><td><code>s</code></td></tr>
<tr><td><code>milliseconds</code></td><td><code>ms</code></td></tr>
</tbody>
</table>
