time format

This commit is contained in:
nixzhu
2015-08-03 17:21:32 +08:00
parent f107d52876
commit d2a0f207ff
2 changed files with 4 additions and 4 deletions
@@ -94,10 +94,10 @@ extension DoNotDisturbPeriodViewController: UIPickerViewDataSource, UIPickerView
func pickerView(pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String! {
if component == 0 {
return "\(row % 24)"
return String(format: "%02d", row % 24)
} else if component == 1 {
return "\(row % 60)"
return String(format: "%02d", row % 60)
}
return ""
@@ -18,10 +18,10 @@ struct DoNotDisturbPeriod {
var toMinute: Int = 30
var fromString: String {
return "\(fromHour):\(fromMinute)"
return String(format: "%02d:%02d", fromHour, fromMinute)
}
var toString: String {
return "\(toHour):\(toMinute)"
return String(format: "%02d:%02d", toHour, toMinute)
}
}