---
schema_version: "1"
id: ec946935b7048e8394537d15c1d435170e153ca493d07ff0708cff34a1a5e068
title: startOf()
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-startof.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/ref-jsapi-auralocalizationservice-startof.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9782b1a2492138b3fc11d1b895c75f892361232b0d87bce8edb5640fb31f5dcb
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# startOf()

Returns a date that is the start of a unit of time for the given date.

## Signature

`startOf(string | number | Date date, string unit)`

## Parameters

**_date_:** Type: `string | number | Date`. A datetime string in ISO8601 format, or a timestamp in milliseconds, or a `Date` object.

**_unit_:** Type: `string`. A datetime unit. Options are 'year', 'month', 'week', 'day', 'hour', 'minute', or 'second'.

## Returns

**Type: `Date`** A JavaScript `Date` object. If a unit is not provided, returns a parsed date.

## Sample Code

```javascript
var date = "2015-10-9";
// Returns "Thu Oct 01 2015 00:00:00 GMT-0700 (PDT)"
$A.localizationService.startOf(date, 'month');
```

