Creates and returns a date object with a date and time value specified by a given string in the international string representation format (YYYY-MM-DD HH:
).
SDK
- macOS 10.4–10.10Deprecated
Framework
- Foundation
Declaration
+ (id)dateWithString:(NSString *)aString;
Parameters
aString
A string that specifies a date and time value in the international string representation format—
YYYY-MM-DD HH:
, whereMM: SS ±HHMM ±HHMM
is a time zone offset in hours and minutes from UTC (for example, “2001-03-24 10:
”).45: 32 +0600 You must specify all fields of the format string, including the time zone offset, which must have a plus or minus sign prefix.
Return Value
An NSDate
object with a date and time value specified by a
.
Discussion
To create a date object from a string, you should typically use a date formatter object instead (see NSDate
and Data Formatting Guide).