---
schema_version: "1"
id: 48f2ced83090fc231839f1ffb026dc248fd099689cd90105538657190a376894
title: getHoursInDuration()
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/ref-jsapi/ref-jsapi-auralocalizationservice-gethoursinduration.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/ref-jsapi-auralocalizationservice-gethoursinduration.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5986f42fae65b185da2f2cd22ef9ef330f5556b34ee3fe2c506f4f2ead060412
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# getHoursInDuration()

Returns a length of time in hours.

## Signature

`getHoursInDuration(Duration duration)`

## Parameters

**_duration_:** Type: `Duration`. The duration object returned by `$A.localizationService.duration`.

## Returns

**Type: `number`** The number of hours in the duration.

## Sample Code

```javascript
var dur = $A.localizationService.duration(60, 'minute');
// Returns 1, the number of hours in the given duration
$A.localizationService.getHoursInDuration(dur);
```

**See Also**  


-   [duration()](https://developer.salesforce.com/docs/platform/aura-platform/guide/ref-jsapi-auralocalizationservice-duration.md)

