I want to ask about NSDate
, how to set/format current time like \"2015-08-12 09:30:41 +0000\" to \"2015-08-12 00:00:00 +0000
I\'m already using :
The easiest way to remove the time portion from an NSDate instance is
let startOfDate = NSCalendar.currentCalendar().startOfDayForDate(NSDate())
To get the date depending on the current time zone use
let calendar = NSCalendar(identifier: NSCalendarIdentifierGregorian)!
calendar.timeZone = NSTimeZone(forSecondsFromGMT: 0)
let startOfDate = calendar.startOfDayForDate(NSDate())
println(startOfDate)
var calendar = Calendar(identifier: .gregorian)
calendar.timeZone = TimeZone(secondsFromGMT: 0)!
let startOfDate = calendar.startOfDay(for: Date())
print(startOfDate)