FS.O FS.O - 2 years ago 97
Swift Question

NSDateFormatter for this format

I want to make an

object for this date format (for example):

2016-04-15 15:00:00

I've tried
yyyy-mm-dd hh:mm:ss
but then when I am trying to attach it to a date like that:

date = [formatter dateFromString:dateString];

It gives me

what is the correct way to do it?

Thank you!

Answer Source

set date format as

2016-04-15 15:00:00
yyyy-MM-dd HH:mm:ss

your date string is 24 hour format

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download