Swift using NSLocale for date formatter - need to set country automatically
<p>I have found the below example and it seems to work in both am-pm mode and 24 hour mode.</p>

<p>The problem is I want to set the locale identifier automatically depending on the user's country.
I did not find a list with the countries or a method to do it automatically.</p>

<p>Can anyone help with an example?</p>

<pre><code>let mydate = "2014-10-28T18:14:32"
let formatter = NSDateFormatter()
formatter.locale = NSLocale(localeIdentifier: "en_US_POSIX")
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss"
if let parsedDateTimeString = formatter.dateFromString(mydate) {
    formatter.stringFromDate(parsedDateTimeString)
    print(parsedDateTimeString)
} else {
    print("Could not parse date")
}
</code></pre>