To run the example project, clone the repo, and run pod install
from the Example directory first.
SDDateHelper is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SDDateHelper', :git => https://github.com/pdn1905/SDDateHelper
How to use:
Import SDDateHelper
Math with Date:
let today = Date() // 21-09-2017 📅
let nextDay = today + 1.day => 22-09-2017 // same with minutes, hours, months, years..
Compare between Dates:
let today = Date() // 21-09-2017
let nextDay = today + 1.day => 22-09-2017
let bool = today < nextDay => return true
Get Network time (if failed return device time):
SDTime().getNetworkTime { (date) in
print(date) => return sync network time.
}
Custom services:
SDTime().getNetworkTime(with: ["time1.google.com","time2.google.com"]) { (date) in
print(date) => return sync network time.
}
let now = SDTime().now => sync network time.
NgocPhan, [email protected]
SDDateHelper is available under the MIT license. See the LICENSE file for more info.