Android examples for java.util:Date Time
Format Date to string in MM-dd a hh:mm format
import android.annotation.SuppressLint; 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 String getTime4TimeTitle(Date date) { SimpleDateFormat format = new SimpleDateFormat("MM-dd a hh:mm", Locale.CHINA);/*www . j a v a2s . c o m*/ return format.format(date); } }