iOS Get Current Date


Example

Getting current date is very easy. You get NSDate object of current date in just single line as follows:

Swift

var date = NSDate()

Swift 3

var date = Date()

Objective-C

NSDate *date = [NSDate date];