うちのいぬ Tech Blog

Tech Blog of Uchinoinu/My dog

NSDate

Get weekday String from NSDate by Swift

Easy way class func weekdayFromNSDate(date: NSDate) -> String { let cal = NSCalendar.currentCalendar() let comp = cal.components(NSCalendarUnit.Weekday, fromDate: date) let weekdayIndex = comp.weekday let formatter: NSDateFormatter = NSDat…

SwiftでNSDateから曜日を求める方法

割りと楽なやり方 class func weekdayFromNSDate(date: NSDate) -> String { let cal = NSCalendar.currentCalendar() let comp = cal.components(NSCalendarUnit.Weekday, fromDate: date) let weekdayIndex = comp.weekday let formatter: NSDateFormatter…