---
schema_version: "1"
id: 035a3e89db371825a115113b89b802c257406e948ed736488f689fb521b23bd4
title: getDateStringBasedOnTimezone
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-getdatestringbasedontimezone.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/ref-jsapi-auralocalizationservice-getdatestringbasedontimezone.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fdbd93f96def117048fea5acdd3e13bf7e804f9cf47b82699265dd4cc2ad727d
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# getDateStringBasedOnTimezone

Gets a date string based on a time zone.

## Signature

`getDateStringBasedOnTimezone (string timeZone, Date date, function callback)`

## Parameters

**_timezone_:** Type: `String`. A time zone ID based on the `` class, for example, `"America/Los_Angeles"`.

**_date_:** Type: `Date`. A JavaScript `Date` object.

**_callback_**

Type: `function`

A function to call after the date string is returned. Access the date string in the first parameter of the callback.

## Sample Code

```javascript
var timezone = $A.get("$Locale.timezone");
var date = new Date();
// Returns the date string in the format "2015-10-9"
$A.localizationService.getDateStringBasedOnTimezone(timezone, date, function(today){
    console.log(today);
});
```

