Convert time string to iOS date format

I have a line @ "21:57" and I want to save it in the same HH: mm format in NSDate. I tried to convert it using:

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; dateFormatter.dateFormat = @"HH:mm"; NSDate *date = [dateFormatter dateFromString:stringToConvertFrom]; 

but I get 2000-01-01 21:57:00 +0000 instead of 21:57.

+3
date ios time nsdate
source share

No one has answered this question yet.

See similar questions:

7
Compare two time values ​​in ios?

or similar:

6549
Why is the subtraction of these two times (in 1927) giving a strange result?
2568
How to find out the current time in Python
2102
How to get current date in JavaScript?
1865
How to format javascript date
1746
Compare two dates with JavaScript
1350
Where can I find date formatting documentation in JavaScript?
1333
Detecting an Invalid Date Date Instance in JavaScript
1039
Get current time and date on Android
910
Convert Unix timestamp to JavaScript
766
Convert Java string to date

All Articles