XuniDateUtil Class Reference
Inherits from | NSObject |
---|---|
Declared in | DateUtil.h |
– getDateWithYear:month:day:
Get a newly allocated NSDate object.
- (NSDate *)getDateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day
Parameters
year |
The year. |
---|---|
month |
The month. |
day |
The day. |
Return Value
A newly allocated NSDate object.
Discussion
Get a newly allocated NSDate object.
Declared In
DateUtil.h
– setCalendar:
Set calendar.
- (void)setCalendar:(NSCalendar *)calendar
Parameters
calendar |
The calendar. |
---|
Discussion
Set calendar.
Declared In
DateUtil.h
– getCalendar
Get calendar.
- (NSCalendar *)getCalendar
Return Value
The calendar.
Discussion
Get calendar.
Declared In
DateUtil.h
– setFirstWeekday:
Set the first weekday of the calendar.
- (void)setFirstWeekday:(NSUInteger)day
Parameters
day |
The first weekday. |
---|
Discussion
Set the first weekday of the calendar.
Declared In
DateUtil.h
– getYearFromDate:
Gets the number of year units from the date.
- (NSInteger)getYearFromDate:(NSDate *)date
Parameters
date |
The date. |
---|
Return Value
The number of year units.
Discussion
Gets the number of year units from the date.
Declared In
DateUtil.h
– getMonthFromDate:
Gets the number of month units from the date.
- (NSInteger)getMonthFromDate:(NSDate *)date
Parameters
date |
The date. |
---|
Return Value
The number of month units.
Discussion
Gets the number of month units from the date.
Declared In
DateUtil.h
– getDayFromDate:
Gets the number of day units from the date.
- (NSInteger)getDayFromDate:(NSDate *)date
Parameters
date |
The date. |
---|
Return Value
The number of day units.
Discussion
Gets the number of day units from the date.
Declared In
DateUtil.h
– getWeekdayFromDate:
Gets the number of weekday units from the date.
- (NSInteger)getWeekdayFromDate:(NSDate *)date
Parameters
date |
The date. |
---|
Return Value
The number of weekday units.
Discussion
Gets the number of weekday units from the date.
Declared In
DateUtil.h
– getMonthDaysCountFromDate:
Gets the month days count from the date.
- (NSInteger)getMonthDaysCountFromDate:(NSDate *)date
Parameters
date |
The date. |
---|
Return Value
The days count of the month.
Discussion
Gets the month days count from the date.
Declared In
DateUtil.h
– getDateByAddingDays:toDate:
Returns a new NSDate object representing the absolute time calculated by adding given days.
- (NSDate *)getDateByAddingDays:(NSInteger)days toDate:(NSDate *)toDate
Parameters
days |
The days to add. |
---|---|
toDate |
The date. |
Return Value
A new NSDate object representing the absolute time calculated by adding given days.
Discussion
Returns a new NSDate object representing the absolute time calculated by adding given days.
Declared In
DateUtil.h
– getDateBySubtractingDays:toDate:
Returns a new NSDate object representing the absolute time calculated by subtracting given days.
- (NSDate *)getDateBySubtractingDays:(NSInteger)days toDate:(NSDate *)toDate
Parameters
days |
The days to subtract. |
---|---|
toDate |
The date. |
Return Value
A new NSDate object representing the absolute time calculated by subtracting given days.
Discussion
Returns a new NSDate object representing the absolute time calculated by subtracting given days.
Declared In
DateUtil.h
– getDateByAddingMonths:toDate:
Returns a new NSDate object representing the absolute time calculated by adding given months.
- (NSDate *)getDateByAddingMonths:(NSInteger)months toDate:(NSDate *)toDate
Parameters
months |
The months to adding. |
---|---|
toDate |
The date. |
Return Value
A new NSDate object representing the absolute time calculated by adding given months.
Discussion
Returns a new NSDate object representing the absolute time calculated by adding given months.
Declared In
DateUtil.h
– getDateBySettingMonth:toDate:
Returns a new NSDate object representing the absolute time which month is the setting value.
- (NSDate *)getDateBySettingMonth:(NSInteger)month toDate:(NSDate *)toDate
Parameters
month |
The month to set. |
---|---|
toDate |
The date. |
Return Value
A new NSDate object representing the absolute time which month is the setting value.
Discussion
Returns a new NSDate object representing the absolute time which month is the setting value.
Declared In
DateUtil.h
– getDateBySettingYear:toDate:
Returns a new NSDate object representing the absolute time which year is the setting value.
- (NSDate *)getDateBySettingYear:(NSInteger)year toDate:(NSDate *)toDate
Parameters
year |
The year to set. |
---|---|
toDate |
The date. |
Return Value
A new NSDate object representing the absolute time which year is the setting value.
Discussion
Returns a new NSDate object representing the absolute time which year is the setting value.
Declared In
DateUtil.h
– getDateByAddingYears:toDate:
Returns a new NSDate object representing the absolute time calculated by adding given years.
- (NSDate *)getDateByAddingYears:(NSInteger)years toDate:(NSDate *)toDate
Parameters
years |
The years to adding. |
---|---|
toDate |
The date. |
Return Value
A new NSDate object representing the absolute time calculated by adding given years.
Discussion
Returns a new NSDate object representing the absolute time calculated by adding given years.
Declared In
DateUtil.h
– isYMDEqual:date2:
Returns whether the year, month and day of the two dates are equal.
- (BOOL)isYMDEqual:(NSDate *)date1 date2:(NSDate *)date2
Parameters
date1 |
The first date. |
---|---|
date2 |
The second date. |
Return Value
YES the year, month and day of the two dates are equal, otherwise NO.
Discussion
Returns whether the year, month and day of the two dates are equal.
Declared In
DateUtil.h
– compareYMD:date2:
Returns an NSComparisonResult value that indicates the temporal ordering of the two dates, only compare year, month and day.
- (NSComparisonResult)compareYMD:(NSDate *)date1 date2:(NSDate *)date2
Parameters
date1 |
The first date, must not be nil. |
---|---|
date2 |
The second date, must not be nil. |
Return Value
The NSComparisonResult.
Discussion
Returns an NSComparisonResult value that indicates the temporal ordering of the two dates, only compare year, month and day.
Declared In
DateUtil.h
– compareYM:date2:
Returns an NSComparisonResult value that indicates the temporal ordering of the two dates, only compare year and month.
- (NSComparisonResult)compareYM:(NSDate *)date1 date2:(NSDate *)date2
Parameters
date1 |
The first date, must not be nil. |
---|---|
date2 |
The second date, must not be nil. |
Return Value
The NSComparisonResult.
Discussion
Returns an NSComparisonResult value that indicates the temporal ordering of the two dates, only compare year and month.
Declared In
DateUtil.h
– compareY:date2:
Returns an NSComparisonResult value that indicates the temporal ordering of the two dates, only compare year.
- (NSComparisonResult)compareY:(NSDate *)date1 date2:(NSDate *)date2
Parameters
date1 |
The first date, must not be nil. |
---|---|
date2 |
The second date, must not be nil. |
Return Value
The NSComparisonResult.
Discussion
Returns an NSComparisonResult value that indicates the temporal ordering of the two dates, only compare year.
Declared In
DateUtil.h