-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSLExtensions.m
More file actions
32 lines (27 loc) · 785 Bytes
/
SLExtensions.m
File metadata and controls
32 lines (27 loc) · 785 Bytes
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
//
// SLExtensions.m
//
// Copyright 2009 Steven Fisher.
//
// This file is covered by the MIT/X11 License.
// See LICENSE.TXT for more information.
//
#import "SLExtensions.h"
@implementation NSDateFormatter(sqlitem)
+ (NSString *)sqlStringFromDate: (NSDate *)inDate;
{
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat: @"yyyy-MM-dd'T'HH:mm:ss ZZZZ"];
NSString *dateString = [dateFormat stringFromDate: inDate];
[dateFormat release];
return dateString;
}
+ (NSDate *)sqlDateFromString: (NSString *)inDate;
{
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat: @"yyyy-MM-dd'T'HH:mm:ss ZZZZ"];
NSDate *date = [dateFormat dateFromString: inDate];
[dateFormat release];
return date;
}
@end