parse Date in dd-MM-yyyy format - Android java.util

Android examples for java.util:Date Parse

Description

parse Date in dd-MM-yyyy format

Demo Code


import android.util.Log;
import java.sql.Time;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main{
    private static final String TAG = TimeDataHelper.class.getSimpleName();
    public static Date parseDate(String date) {
        try {/*from  ww w . j a  va2  s . c om*/
            return new SimpleDateFormat("dd-MM-yyyy").parse(date);
        } catch (ParseException e) {
            Log.e(TAG, e.toString());
        }
        return null;
    }
}

Related Tutorials