Android examples for java.util:Date Parse
parse string in yyyy/MM/dd format and default locale To Date
import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.text.TextUtils; import android.util.Base64; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; public class Main{ public static Date parseToDate(String dateString) { SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); try {/*from ww w .ja va2 s.c o m*/ return format.parse(dateString); } catch (ParseException e) { return new Date(); } } }