- Add More Date Format

This commit is contained in:
Giuseppe Nucifora 2017-01-16 14:14:33 +01:00
parent 9aed3ad7ba
commit 07effb57e9
7 changed files with 43 additions and 15 deletions

View File

@ -9,7 +9,7 @@ PODS:
- FBSnapshotTestCase/Core (2.1.4) - FBSnapshotTestCase/Core (2.1.4)
- FBSnapshotTestCase/SwiftSupport (2.1.4): - FBSnapshotTestCase/SwiftSupport (2.1.4):
- FBSnapshotTestCase/Core - FBSnapshotTestCase/Core
- NSDate_Utils (1.0.3) - NSDate_Utils (1.0.4)
- Specta (1.0.5) - Specta (1.0.5)
DEPENDENCIES: DEPENDENCIES:
@ -27,7 +27,7 @@ SPEC CHECKSUMS:
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516 Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a' FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a'
NSDate_Utils: 2fb4071323341507c610821bc99b98ef8c46d4ac NSDate_Utils: f5c025fb1f814f25525aedd8dbf08f5e256a3ddd
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2 Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
PODFILE CHECKSUM: 5d3cb6429ba8613bec51b3e797c0070e91be6b26 PODFILE CHECKSUM: 5d3cb6429ba8613bec51b3e797c0070e91be6b26

View File

@ -1,6 +1,6 @@
{ {
"name": "NSDate_Utils", "name": "NSDate_Utils",
"version": "1.0.3", "version": "1.0.4",
"summary": "NSDate_Utils is a NSDate category that helps date managements. For example NSString to NSDate, NSDate to NSString,NSSdate comparisons", "summary": "NSDate_Utils is a NSDate category that helps date managements. For example NSString to NSDate, NSDate to NSString,NSSdate comparisons",
"homepage": "https://github.com/giuseppenucifora/NSDate_Utils", "homepage": "https://github.com/giuseppenucifora/NSDate_Utils",
"license": "MIT", "license": "MIT",
@ -9,7 +9,7 @@
}, },
"source": { "source": {
"git": "https://github.com/giuseppenucifora/NSDate_Utils.git", "git": "https://github.com/giuseppenucifora/NSDate_Utils.git",
"tag": "1.0.3" "tag": "1.0.4"
}, },
"platforms": { "platforms": {
"ios": "7.0" "ios": "7.0"

View File

@ -9,7 +9,7 @@ PODS:
- FBSnapshotTestCase/Core (2.1.4) - FBSnapshotTestCase/Core (2.1.4)
- FBSnapshotTestCase/SwiftSupport (2.1.4): - FBSnapshotTestCase/SwiftSupport (2.1.4):
- FBSnapshotTestCase/Core - FBSnapshotTestCase/Core
- NSDate_Utils (1.0.3) - NSDate_Utils (1.0.4)
- Specta (1.0.5) - Specta (1.0.5)
DEPENDENCIES: DEPENDENCIES:
@ -27,7 +27,7 @@ SPEC CHECKSUMS:
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516 Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a' FBSnapshotTestCase: '094f9f314decbabe373b87cc339bea235a63e07a'
NSDate_Utils: 2fb4071323341507c610821bc99b98ef8c46d4ac NSDate_Utils: f5c025fb1f814f25525aedd8dbf08f5e256a3ddd
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2 Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
PODFILE CHECKSUM: 5d3cb6429ba8613bec51b3e797c0070e91be6b26 PODFILE CHECKSUM: 5d3cb6429ba8613bec51b3e797c0070e91be6b26

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.3</string> <string>1.0.4</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>

View File

@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "NSDate_Utils" s.name = "NSDate_Utils"
s.version = "1.0.3" s.version = "1.0.4"
s.summary = "NSDate_Utils is a NSDate category that helps date managements. For example NSString to NSDate, NSDate to NSString,NSSdate comparisons" s.summary = "NSDate_Utils is a NSDate category that helps date managements. For example NSString to NSDate, NSDate to NSString,NSSdate comparisons"
# This description is used to generate tags and improve search results. # This description is used to generate tags and improve search results.

View File

@ -42,14 +42,23 @@ static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeIT_shashSeparated
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN = @"MM-dd-yyyy HH:mm:ss"; static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN = @"MM-dd-yyyy HH:mm:ss";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated = @"MM/dd/yyyy HH:mm:ss"; static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated = @"MM/dd/yyyy HH:mm:ss";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone = @"yyyy-MM-dd'T'HH:mm:ss'Z'"; static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone_T_Separator = @"yyyy-MM-dd'T'HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated = @"yyyy/MM/dd'T'HH:mm:ss'Z'"; static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone_T_Separator_shashSeparated = @"yyyy/MM/dd'T'HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN = @"MM-dd-yyyy'T'HH:mm:ss'Z'"; static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN_T_Separator = @"MM-dd-yyyy'T'HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN_shashSeparated = @"MM/dd/yyyy'T'HH:mm:ss'Z'"; static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneENAndTSeparator_shashSeparated = @"MM/dd/yyyy'T'HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT = @"dd-MM-yyyy'T'HH:mm:ss'Z'"; static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_T_Separator = @"dd-MM-yyyy'T'HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparated = @"dd/MM/yyyy'T'HH:mm:ss'Z'"; static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_T_Separator_shashSeparated = @"dd/MM/yyyy'T'HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone = @"yyyy-MM-dd HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated = @"yyyy/MM/dd HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN = @"MM-dd-yyyy HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneEN_shashSeparated = @"MM/dd/yyyy HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT = @"dd-MM-yyyy HH:mm:ss'Z'";
static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparated = @"dd/MM/yyyy HH:mm:ss'Z'";
@interface NSDate (NSDate_Util) @interface NSDate (NSDate_Util)
@ -82,6 +91,9 @@ static NSString * _Nonnull kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparat
+ (NSString * _Nonnull) getUniversalHourFromDateString:(NSString * _Nonnull) string formatterString:(NSString * _Nonnull) formatterString andUppercaseString:(BOOL) uppercaseString; + (NSString * _Nonnull) getUniversalHourFromDateString:(NSString * _Nonnull) string formatterString:(NSString * _Nonnull) formatterString andUppercaseString:(BOOL) uppercaseString;
+ (NSTimeInterval) timeIntervalFromMinutes:(NSUInteger) minutes;
+ (NSTimeInterval) timeIntervalFromHours:(NSUInteger) minutes;
- (NSDate * _Nonnull) dateToNearestMinutes:(NSInteger)minutes; - (NSDate * _Nonnull) dateToNearestMinutes:(NSInteger)minutes;
- (NSDate * _Nonnull) dateByAddingMinutes:(NSInteger) dMinutes; - (NSDate * _Nonnull) dateByAddingMinutes:(NSInteger) dMinutes;

View File

@ -194,7 +194,10 @@ static NSDateFormatter *_displayFormatter = nil;
kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZone, kNSDateHelperFormatSQLDateWithTimeEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZone,
kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneEN, kNSDateHelperFormatSQLDateWithTimeZone_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneEN,
kNSDateHelperFormatSQLDateWithTimeZoneEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneIT, kNSDateHelperFormatSQLDateWithTimeZoneEN_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneIT,
kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparated, nil]; kNSDateHelperFormatSQLDateWithTimeZoneIT_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZone_T_Separator,
kNSDateHelperFormatSQLDateWithTimeZone_T_Separator_shashSeparated,kNSDateHelperFormatSQLDateWithTimeZoneEN_T_Separator,
kNSDateHelperFormatSQLDateWithTimeZoneENAndTSeparator_shashSeparated, kNSDateHelperFormatSQLDateWithTimeZoneIT_T_Separator,
kNSDateHelperFormatSQLDateWithTimeZoneIT_T_Separator_shashSeparated, nil];
for (NSString *dateFormat in dateFormatsArray) { for (NSString *dateFormat in dateFormatsArray) {
@ -516,6 +519,19 @@ static NSDateFormatter *_displayFormatter = nil;
} }
+ (NSTimeInterval) timeIntervalFromMinutes:(NSUInteger) minutes {
NSTimeInterval seconds = minutes /60;
return seconds;
}
+ (NSTimeInterval) timeIntervalFromHours:(NSUInteger) hours {
}
- (NSDate *) dateAtStartOfDay - (NSDate *) dateAtStartOfDay
{ {
NSDateComponents *components = [CURRENT_CALENDAR components:DATE_COMPONENTS fromDate:self]; NSDateComponents *components = [CURRENT_CALENDAR components:DATE_COMPONENTS fromDate:self];