forked from brightsoftdev/Additions-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNSDate+Additions.h
More file actions
69 lines (48 loc) · 1.46 KB
/
NSDate+Additions.h
File metadata and controls
69 lines (48 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// NSDate+Additions.h
//
// Created by Wess Cope on 6/1/11.
// Copyright 2012. All rights reserved.
//
#import <Foundation/Foundation.h>
struct DateInformation {
int day;
int month;
int year;
int weekday;
int minute;
int hour;
int second;
};
typedef struct DateInformation DateInformation;
typedef enum {
NSDateSecondsType = 0,
NSDateMinutesType = 1,
NSDateHoursType = 2,
NSDateDaysType = 3,
NSDateWeekType = 4,
NSDateMonthsType = 5,
NSDateYearType = 6
} NSDateTimeType;
@interface NSDate(Additions)
+(int) unixTimestampFromDate:(NSDate *)aDate;
+(int) unixTimestampNow;
+ (NSDate *)date:(NSDate *)aDate add:(NSUInteger)increment of:(NSDateTimeType)type;
+ (NSDate *) yesterday;
+ (NSDate *) month;
- (NSDate *) monthDate;
//- (NSDate *) lastOfMonthDate;
- (BOOL) isSameDay:(NSDate*)anotherDate;
- (int) monthsBetweenDate:(NSDate *)toDate;
- (NSInteger) daysBetweenDate:(NSDate*)d;
- (BOOL) isToday;
- (NSDate *) dateByAddingDays:(NSUInteger)days;
+ (NSDate *) dateWithDatePart:(NSDate *)aDate andTimePart:(NSDate *)aTime;
- (NSString *) monthString;
- (NSString *) yearString;
- (DateInformation) dateInformation;
- (DateInformation) dateInformationWithTimeZone:(NSTimeZone*)tz;
+ (NSDate*) dateFromDateInformation:(DateInformation)info;
+ (NSDate*) dateFromDateInformation:(DateInformation)info timeZone:(NSTimeZone*)tz;
+ (NSString*) dateInformationDescriptionWithInformation:(DateInformation)info;
@end