title: Get the format of date | Swift | iOS
body: <p>As per the requirement, my API might return date in either "2018-01-01" or "01-01-2018" or "2018-01-01T00:00:00" format</p>
  
  <p>How can I check the format of the date? </p>
  
  <p>eg: my code for API response "2018-01-01" should return me "yyyy-MM-dd" etc.. </p>
  
  <p>I can do this by checking length of my characters and by assigning date format accordingly..but i feel this is not the right approach.</p>