/* Copyright (c) 2014 Andrea Zoli. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

package it.inaf.android;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;

public class DateFormatter {
    public static String format(String date)
    {
        SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z");
        java.util.Date tmpDate = null;
        try {
            tmpDate = format.parse(date);
        } catch(ParseException e) {
            format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
            try {
                tmpDate = format.parse(date);
            } catch (ParseException e1) {
                format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
                try {
                    tmpDate = format.parse(date);
                } catch (ParseException e2) {
                    e2.printStackTrace();
                }
            }
        }

        SimpleDateFormat postFormater = new SimpleDateFormat("dd.MM.yyyy", Locale.ITALY);
        return postFormater.format(tmpDate);
    }
}
@@ -441,19 +441,30 @@
 mm:ss Z%22
+, Locale.UK
 );%0A
-
         
@@ -654,24 +654,35 @@
 m:ss.SSS'Z'%22
+, Locale.UK
 );%0A         
@@ -774,24 +774,24 @@
 ption e1) %7B%0A
-
             
@@ -850,16 +850,27 @@
 m:ss'Z'%22
+, Locale.UK
 );%0A     

Use Locale.UK while parsing dates.