Parse time value in String for China locale - Android java.util

Android examples for java.util:Date Parse

Description

Parse time value in String for China locale

Demo Code

import android.text.format.DateUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;

public class Main{

    public static Date getTimeFromString(String formatTime, String time)
            throws ParseException {
        SimpleDateFormat format = new SimpleDateFormat(formatTime,
                Locale.CHINA);//  w ww  .  j a va 2 s . c o  m
        return format.parse(time);
    }

}

Related Tutorials