-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNiceDate.h
64 lines (48 loc) · 1.83 KB
/
NiceDate.h
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
//
// NiceDate.h
// NiceDate
//
// Created by Michael Sprague on 5/20/13.
//
#import <Foundation/Foundation.h>
@interface NiceDate : NSObject
@property (nonatomic, assign) NSUInteger second;
@property (nonatomic, assign) NSUInteger minute;
@property (nonatomic, assign) NSUInteger hour;
@property (nonatomic, assign) NSUInteger day;
@property (nonatomic, assign, readonly) NSUInteger dayOfWeek;
@property (nonatomic, assign, readonly) NSString *shortDayOfWeekString;
@property (nonatomic, assign, readonly) NSString *dayOfWeekString;
@property (nonatomic, assign) NSUInteger month;
@property (nonatomic, assign, readonly) NSString *monthString;
@property (nonatomic, assign) NSUInteger year;
@property (nonatomic, strong) NSString *format;
@property (nonatomic, strong) NSTimeZone *timeZone;
@property (nonatomic, strong) NSDate *date;
// Just in case you don't feel like Gregorian ;)
@property (nonatomic, strong) NSString *calendarIdentifier;
// create with current date/time
- (id) init;
// create with supplied date/time
- (id) initWithDate: (NSDate*) date;
// Create with another nice date
- (id) initWithNiceDate: (NiceDate*)niceDate;
// overrides description to display formatted date
- (NSString *) description;
// unix timestamp
- (NSTimeInterval) unixTime;
// gets a date/time stamp formatted YYYY-mm-dd H:i:s
- (NSString *) mysqlDateTime;
// The same as alloc init
+ (NiceDate *) niceDate;
// The same as alloc initWithDate
+ (NiceDate *) niceDateWithDate: (NSDate*) date;
// Ditto
+ (NiceDate*) niceDateWithNiceDate: (NiceDate*)niceDate;
// current time in mysql format, intended for one-time use
+ (NSString *) currentMysqlDateTime;
// current unix timestamp, intended for one-time use
+ (NSTimeInterval) currentUnixTime;
// returns whether two NiceDate instances are equal or not
- (BOOL)isEqualToNiceDate:(NiceDate *)otherDate;
@end