I have time
in string
format for example 2:00
. I want to initialize it to NSDate
with present date
.
I tried doin
func initializeDateWithTime(date:NSDate,hrs:Int,minutes:Int) -> NSDate{
let today = date
let gregorian:NSCalendar = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)!
let dateComponents = gregorian.components([.Year, .Month, .Day], fromDate: today)
dateComponents.hour = hrs;
dateComponents.minute = minute;
let todayAtX = gregorian.dateFromComponents(dateComponents)
return todayAtX!
}