Skip to content
Ilho Ahn edited this page Nov 19, 2013 · 4 revisions

##Summary

For easy using Date calculation and conversation.

  • Convert NSDate, NSDictionary, DateTimeSet
  • Get Date and Calculation before, after date

##Date Models

This Class use 3 Classes to store date information. It only handle year, month, day.

  • NSDate
  • NSDictionary : Defined keys DATEDIC_YEAR, DATEDIC_MONTH, DATEDIC_DAY
  • DateTimeSet : Simple. Recommend it to use mainly.
@interface DateTimeSet : NSObject
{
    NSTimeInterval  interval;
    
    NSInteger       hours;
    NSInteger       minutes;
    NSInteger       seconds;
    
    NSInteger       year;
    NSInteger       month;
    NSInteger       day;
       
}

##Convert NSDate, NSDictionary, DateTimeSet

####+ (NSDictionary ) NSDateToDateDic:(NSDate) date

NSDate -> NSDictionary

####+ (DateTimeSet ) NSDateToDateTimeSet:(NSDate) date

NSDate -> DateTimeSet

####+ (DateTimeSet *) NSIntervalToTimeSet: (NSTimeInterval) interval

NSInterval -> DateTimeSet(properties: interval, hours, minutes, seconds)

##Get Date nad Calculation before, after date

####+ (NSDictionary *) getNowDate

Get now date with NSDictionary.

####+ (DateTimeSet *) getNowDateTimeSet

Get now date with DateTimeSet

####+ (NSDate *) getNextDate:(NSInteger) offset AndYear:(NSInteger) theYear andMonth:(NSInteger) theMonth andDay:(NSInteger) theDay

Get next +/- offset date with NSDictionary

Example)

// Getting tomorrow and more
[DateUtil getNextDate:+1];
[DateUtil getNextDate:+2];
// Getting Yesterday
[DateUtil getNextDate:-1];

####+ (NSDictionary *) getNextDateDicFromOffset:(NSInteger) offset AndYear:(NSInteger) theYear andMonth:(NSInteger) theMonth andDay:(NSInteger) theDay

Get next +/- offset date with NSDictionary

####+ (DateTimeSet *) getNextDateSetFromOffset:(NSInteger) offset AndYear:(NSInteger) theYear andMonth:(NSInteger) theMonth andDay:(NSInteger) theDay

Get next +/- offset date with DateTimeSet

Version

Version 0.0.1 Build 61 Release 1

Clone this wiki locally