---
title: "date(withNaturalLanguageString:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nsdate/date(withnaturallanguagestring:)"
---

# date(withNaturalLanguageString:)

Creates and returns a date object set to the date and time specified by a given string.

## Declaration

```swift
class func date(withNaturalLanguageString string: String) -> Any?
```

## Parameters

- `string`: A string that contains a colloquial specification of a date, such as “last Tuesday at dinner,” “3pm December 31, 2001,” “12/31/01,” or “31/12/01.”

## Return Value

Return Value A new NSDate object set to the current date and time specified by string.

## Discussion

Discussion This method supports only a limited set of colloquial phrases, primarily in English. It may give unexpected results, and its use is strongly discouraged. To create a date object from a string, you should use a date formatter object instead (see DateFormatter and Data Formatting Guide). In parsing the string, this method uses the date and time preferences stored in the user’s defaults database. (See date(withNaturalLanguageString:locale:) for a list of the specific items used.)

## See Also

### Legacy Operations

- [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)
- [date(withCalendarFormat:timeZone:)](foundation/nsdate/date(withcalendarformat:timezone:).md)
- [description(withCalendarFormat:timeZone:locale:)](foundation/nsdate/description(withcalendarformat:timezone:locale:).md)
