Here you can find the source of getDayWeekDateStr(Date date)
public static String getDayWeekDateStr(Date date)
//package com.java2s; /**//from ww w.ja va 2 s. com * License: https://github.com/votingsystem/votingsystem/wiki/Licencia */ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getDayWeekDateStr(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if (Calendar.getInstance().get(Calendar.YEAR) != calendar.get(Calendar.YEAR)) return getDateStr(date, "dd MMM yyyy' 'HH:mm"); else return getDateStr(date, "EEE dd MMM' 'HH:mm"); } public static String getDateStr(Date date) { DateFormat formatter = new SimpleDateFormat("yyyy/MM/dd' 'HH:mm:ss"); return formatter.format(date); } public static String getDateStr(Date date, String format) { SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(date); } }