public class NSCalendar extends NSObject implements NSSecureCoding
Modifier and Type | Method and Description |
---|---|
NSDateComponents |
components(int NSCalendarUnit,
NSDate fromDate)
Returns a NSDateComponents object that is the representation of the
specified date using the specified calendar unit.
|
NSDateComponents |
components(int NSCalendarUnit,
NSDate fromDate,
NSDate toDate,
int NSDateComponents)
Returns a NSDateComponents object that results from the subtraction of
the two date using the specified options..
|
static NSCalendar |
currentCalendar()
Returns user's current calendar.
|
NSDate |
dateByAddingComponents(NSDateComponents comps,
NSDate toDate,
int opts)
Returns a date that results from adding the specified components to the
specified date.
|
NSDate |
dateFromComponents(NSDateComponents comps)
Returns a NSDate object that corresponds to the specified date
components.
|
addObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKey
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportsSecureCoding
public static NSCalendar currentCalendar()
public NSDateComponents components(int NSCalendarUnit, NSDate fromDate)
NSCalendarUnit
- The calendar unit used for the transformation of
the date.fromDate
- The initial date.public NSDateComponents components(int NSCalendarUnit, NSDate fromDate, NSDate toDate, int NSDateComponents)
NSCalendarUnit
- The calendar unit that is used.fromDate
- The staring date.toDate
- The ending date.NSDateComponents
- The components used for the calculation.public NSDate dateByAddingComponents(NSDateComponents comps, NSDate toDate, int opts)
comps
- The components to add to the specified date.toDate
- The date to which the components are added.opts
- Options used for the calculation of the new date.public NSDate dateFromComponents(NSDateComponents comps)
comps
- The components of this date.Copyright © 2020. All rights reserved.