Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions DateTools/DateTools/NSDate+DateTools.m
Original file line number Diff line number Diff line change
Expand Up @@ -813,12 +813,8 @@ + (NSDate *)dateWithString:(NSString *)dateString formatString:(NSString *)forma

+ (NSDate *)dateWithString:(NSString *)dateString formatString:(NSString *)formatString timeZone:(NSTimeZone *)timeZone {

static NSDateFormatter *parser = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
parser = [[NSDateFormatter alloc] init];
});


NSDateFormatter *parser = [[NSDateFormatter alloc] init];
parser.dateStyle = NSDateFormatterNoStyle;
parser.timeStyle = NSDateFormatterNoStyle;
parser.timeZone = timeZone;
Expand Down Expand Up @@ -1619,12 +1615,8 @@ -(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style locale:(NSLocale
* @return NSString representing the formatted date string
*/
-(NSString *)formattedDateWithStyle:(NSDateFormatterStyle)style timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale{
static NSDateFormatter *formatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
formatter = [[NSDateFormatter alloc] init];
});


NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:style];
[formatter setTimeZone:timeZone];
[formatter setLocale:locale];
Expand Down Expand Up @@ -1677,12 +1669,8 @@ -(NSString *)formattedDateWithFormat:(NSString *)format locale:(NSLocale *)local
* @return NSString representing the formatted date string
*/
-(NSString *)formattedDateWithFormat:(NSString *)format timeZone:(NSTimeZone *)timeZone locale:(NSLocale *)locale{
static NSDateFormatter *formatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
formatter = [[NSDateFormatter alloc] init];
});


NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:format];
[formatter setTimeZone:timeZone];
[formatter setLocale:locale];
Expand Down