Android examples for java.util:Date
convert time Stamp in format of yyyy-MM-dd To Date
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.regex.Pattern; public class Main{ private final static SimpleDateFormat dateFormater2 = new SimpleDateFormat( "yyyy-MM-dd", Locale.CHINA); public static String convertimeStampToDate2(String time) { try {/* w ww. j ava 2s. c o m*/ return dateFormater2.format(new Date(toLong(time) * 1000L)); } catch (Exception e) { return null; } } public static long toLong(String obj) { try { return Long.parseLong(obj); } catch (Exception e) { } return 0; } }