Java tutorial
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static Date getDateByFormat(String strDate, String format) { SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat(format, Locale.CHINA); Date date = null; try { date = mSimpleDateFormat.parse(strDate); } catch (ParseException e) { e.printStackTrace(); } return date; } }