forked from shaojiankui/JKCategories
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jakey
committed
Nov 26, 2016
1 parent
00cce1a
commit 315d734
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// NSDate+JKZeroDate.h | ||
// Jakey | ||
// | ||
// Created by Jakey on 15/5/9. | ||
// Copyright (c) 2015年 Jakey. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface NSDate (JKZeroDate) | ||
+ (NSDate *)jk_zeroTodayDate; | ||
+ (NSDate *)jk_zero24TodayDate; | ||
|
||
- (NSDate *)jk_zeroDate; | ||
- (NSDate *)jk_zero24Date; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// NSDate+JKZeroDate.m | ||
// Jakey | ||
// | ||
// Created by Jakey on 15/5/9. | ||
// Copyright (c) 2015年 Jakey. All rights reserved. | ||
// | ||
|
||
#import "NSDate+JKZeroDate.h" | ||
|
||
@implementation NSDate (JKZeroDate) | ||
+ (NSDate *)jk_zeroTodayDate | ||
{ | ||
NSCalendar *calendar = [NSCalendar currentCalendar]; | ||
NSDateComponents *components = [calendar components:NSUIntegerMax fromDate:[NSDate date]]; | ||
components.hour = 0; | ||
components.minute = 0; | ||
components.second = 0; | ||
return [calendar dateFromComponents:components]; | ||
} | ||
|
||
+ (NSDate *)jk_zero24TodayDate | ||
{ | ||
NSCalendar *calendar = [NSCalendar currentCalendar]; | ||
NSDateComponents *components = [calendar components:NSUIntegerMax fromDate:[NSDate date]]; | ||
components.hour = 23; | ||
components.minute = 59; | ||
components.second = 0; | ||
return [calendar dateFromComponents:components]; | ||
} | ||
|
||
- (NSDate *)jk_zeroDate | ||
{ | ||
NSCalendar *calendar = [NSCalendar currentCalendar]; | ||
NSDateComponents *components = [calendar components:NSUIntegerMax fromDate:self]; | ||
components.hour = 0; | ||
components.minute = 0; | ||
components.second = 0; | ||
return [calendar dateFromComponents:components]; | ||
} | ||
- (NSDate *)jk_zero24Date | ||
{ | ||
NSCalendar *calendar = [NSCalendar currentCalendar]; | ||
NSDateComponents *components = [calendar components:NSUIntegerMax fromDate:self]; | ||
components.hour = 23; | ||
components.minute = 59; | ||
components.second = 0; | ||
return [calendar dateFromComponents:components]; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters