Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 72 lines (46 sloc) 2.508 kB
34dbef4 bold if due today or past due
Greg Allen authored
1 //
2 // NSDateHelper.h
3 // Enormego Cocoa Helpers
4 //
5 // Created by Shaun Harrison on 10/15/08.
6 // Copyright 2008 enormego. All rights reserved.
7 //
8
9 #import <Foundation/Foundation.h>
10
11
12 @interface NSDate (Helper)
13
14 + (NSDate*)dateFromOffSetDays:(NSInteger)offset;
15
16
17 // Returns an NSDate based on a string with formatting options passed to NSDateFormatter
18 + (NSDate*)dateWithString:(NSString*)dateString formatString:(NSString*)dateFormatterString;
19
20 // Returns an NSDate with an ISO8610 format, aka ATOM: yyyy-MM-dd'T'HH:mm:ssZZZ
21 + (NSDate*)dateWithISO8601String:(NSString*)str;
22
23 // Returns an NSDate with a 'yyyy-MM-dd' string
24 + (NSDate*)dateWithDateString:(NSString*)str;
25
26 // Returns an NSDate with a 'yyyy-MM-dd HH:mm:ss' string
27 + (NSDate*)dateWithDateTimeString:(NSString*)str;
28
29 // Returns an NSDate with a 'dd MMM yyyy HH:mm:ss' string
30 + (NSDate*)dateWithLongDateTimeString:(NSString*)str;
31
32 // Returns an NSDate with an RSS formatted string: 'EEE, d MMM yyyy HH:mm:ss ZZZ' string
33 + (NSDate*)dateWithRSSDateString:(NSString*)str;
34
35 // Returns an NSDate with an alternative RSS formatted string: 'd MMM yyyy HH:mm:ss ZZZ' string
36 + (NSDate*)dateWithAltRSSDateString:(NSString*)str;
37
38
39 // Pass in an string compatible with NSDateFormatter
40 - (NSString*)formattedDateWithFormatString:(NSString*)dateFormatterString;
41
42
43 // Returns date formatted to: EEE, d MMM 'at' h:mma
44 - (NSString*)formattedDate;
45
46 // Returns date formatted to: NSDateFormatterShortStyle
47 - (NSString*)formattedTime;
48
49 // Returns date formatted to: Weekday if within last 7 days, Yesterday/Tomorrow, or NSDateFormatterShortStyle for everything else
50 - (NSString*)relativeFormattedDate;
51
52 // Returns date formatted to: Weekday if within last 7 days, Yesterday/Today/Tomorrow, or NSDateFormatterShortStyle for everything else
53 // If date is today, returns no Date, instead returns NSDateFormatterShortStyle for time
54 - (NSString*)relativeFormattedDateOnly;
55
56 // Returns date formatted to: Weekday if within last 7 days, Yesterday/Today/Tomorrow, or NSDateFormatterFullStyle for everything else
57 // Also returns NSDateFormatterShortStyle for time
58 - (NSString*)relativeFormattedDateTime;
59
60 // Returns date formatted to: Weekday if within last 7 days, Yesterday/Today/Tomorrow, or NSDateFormatterFullStyle for everything else
61 - (NSString*)relativeLongFormattedDate;
62
63 // Returns date formatted for ISO8601/ATOM: yyyy-MM-dd'T'HH:mm:ssZZZ
64 - (NSString*)iso8601Formatted;
65
66 // Checks whether current date is past date
67 - (BOOL)isPastDate;
68
69
70 -(NSDate*) dateOnly;
71 @end
Something went wrong with that request. Please try again.