You have time.text = 02:00 AM
and you set your formatter on HH:mm:ss
.
It’s a wrong formatter, that’s why is null.
Related Contents:
- Difference between ‘YYYY’ and ‘yyyy’ in NSDateFormatter
- Date Format in Swift
- DateFormatter’s returns nil for specific date strings without time in Swift
- Convert string with unknown format (any format) to date
- Unexpected value from NSDate
- swift NSDateFormatter not working
- How do I get an ISO 8601 date on iOS?
- How do I convert a date/time string into a different date string?
- How to convert NSDate in to relative format as “Today”,”Yesterday”,”a week ago”,”a month ago”,”a year ago”?
- Converting NSString to NSDate (and back again)
- Getting the difference between two Dates (months/days/hours/minutes/seconds) in Swift
- How to input currency format on a text field (from right to left) using Swift?
- Converting String to Int with Swift
- Getting and Setting Cursor Position of UITextField and UITextView in Swift
- How do I check when a UITextField changes?
- iPhone UITextField – Change placeholder text color
- How to create a multiline UITextfield?
- iPad keyboard will not dismiss if modal ViewController presentation style is UIModalPresentationFormSheet
- 1st april dates of 80s failed to parse in iOS 10.0
- Create space at the beginning of a UITextField
- UITextField’s numerical pad: dot instead of comma for float values
- Set the maximum character length of a UITextField in Swift
- Blank space at top of UITextView in iOS 10
- How do you dismiss the keyboard when editing a UITextField
- How do you create a Swift Date object?
- Comparing NSDates without time component
- What is the best way to deal with the NSDateFormatter locale “feature”?
- How can I add a toolbar above the keyboard?
- Allow only alphanumeric characters for a UITextField
- Dismiss keyboard on touch anywhere outside UITextField
- NSDateFormatter milliseconds bug
- Formatting a UITextField for credit card input like (xxxx xxxx xxxx xxxx)
- UITextField secureTextEntry bullets with a custom font?
- Is it possible to change color of single word in UITextView and UITextField
- Swift – Get local date and time
- How can I set an NSDate object to midnight?
- NSDate – Convert Date to GMT
- How to determine if an NSDate is today?
- Control cursor position in UITextField
- Current Week Start and End Date
- Moving the cursor to the beginning of UITextField
- How to convert NSDate into unix timestamp iphone sdk?
- Minimum and maximum date in UIDatePicker
- How can I restrict special characters in UITextField except dot and underscores?
- Add lefthand margin to UITextField
- NSDateFormatter: Date according to currentLocale, without Year
- How to dismiss keyboard iOS programmatically when pressing return
- Getting the Value of a UITextField as keystrokes are entered?
- iOS: How to get a proper Month name from a number?
- Email validation on textField in iOS