title: Date Format Swift - More than one input format
body: <p>I have been following the multiple examples to convert my iso date string to a local date String and have got the following working:</p>
  
  <pre><code>    func ISOStringToLocal(ISODateString: String) -&gt; String {
          let dateFormatterGet = DateFormatter()
          dateFormatterGet.timeZone = NSTimeZone(name: "UTC")! as TimeZone
          dateFormatterGet.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZZZZZ" //Input Format with seconds
          // dateFormatter.dateFormat = " yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" //Input Format with milliseconds
  
          let dateFormatterPrint = DateFormatter()
          dateFormatterPrint.dateFormat = "dd-MMM-yyyy hh:mm:ss"
  
          if let date = dateFormatterGet.date(from: ISODateString) {
              return dateFormatterPrint.string(from: date)
          } else {
              return ""
          }
      }
  </code></pre>
  
  <p>How do I allow the the <code>dateFormatterGet</code> to accept another input format for milliseconds as well as seconds?</p>