Commonly used date methods, Creating dates, Adjusting a date – Apple WebObjects 3.5 User Manual
Page 207
Commonly Used Date Methods
207
Commonly Used Date Methods
The following sections list some of the most commonly used methods of
NSCalendarDate, grouped according to function.
Creating Dates
The methods in this section are class methods, denoted by the plus sign (+).
You use class methods to send messages to a class—in this case,
NSCalendarDate. For more information on class methods, see “Sending a
Message to a Class” (page 172).
+ calendarDate
Returns an NSCalendarDate initialized to the current date and
time.
+ dateWithString:calendarFormat:
Returns an NSCalendarDate initialized to the date in a provided
string, and sets the new NSCalendarDate’s calendar format to the
specified format. The date string must match the provided format
exactly. See “Date Conversion Specifiers” (page 206) for more
detailed information on formats used by NSCalendarDate.
Adjusting a Date
– dateByAddingYears:months:days:hours:minutes:seconds:
Returns an NSCalendarDate derived from the receiver by adding
a specified number of years, months, days, hours, minutes, and
seconds.
%x
date using date representation for the locale
%X
time using time representation for the locale
%Y, %y
year with century (such as 1990) and year without century (00-99),
respectively
%Z, %z
time zone abbreviation (such as PDT) and time zone offset in hours and
minutes from GMT (HHMM), respectively
Conversion Specifier
Argument Type