---
title: "date(withCalendarFormat:timeZone:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsdate/date(withcalendarformat:timezone:)"
---

# date(withCalendarFormat:timeZone:)

Converts the receiver to a calendar date with a given format string and time zone.

## Declaration

```swift
func date(withCalendarFormat format: String?, timeZone aTimeZone: TimeZone?) -> NSCalendarDate
```

## Parameters

- `format`: The format for the returned string (see Date and Number Formatters in OS X v10.0 to 10.3 for a discussion of how to create the format string). Pass nil to use the default format string, “%Y-%m-%d %H:%M:%S %z” (this conforms to the international format YYYY-MM-DD HH:MM:SS ±HHMM.)
- `aTimeZone`: The time zone for the new calendar date. Pass nil to use the default time zone—specific to the current locale.

## Return Value

Return Value A new NSCalendarDate object bound to format and the time zone aTimeZone.

## See Also

### Legacy Operations

- [date(withNaturalLanguageString:)](foundation/nsdate/date(withnaturallanguagestring:).md)
- [date(withNaturalLanguageString:locale:)](foundation/nsdate/date(withnaturallanguagestring:locale:).md)
- [date(with:)](foundation/nsdate/date(with:).md)
- [init(string:)](foundation/nsdate/init(string:).md)
- [addTimeInterval(_:)](foundation/nsdate/addtimeinterval(_:).md)
- [description(withCalendarFormat:timeZone:locale:)](foundation/nsdate/description(withcalendarformat:timezone:locale:).md)
