Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String getShortFormattedDate(Date date, Locale locale) { Calendar calendarToday = Calendar.getInstance(); Calendar calendarDate = Calendar.getInstance(); calendarDate.setTime(date); if (calendarToday.get(Calendar.DAY_OF_WEEK) == calendarDate.get(Calendar.DAY_OF_WEEK)) { return new SimpleDateFormat("HH:mm", locale).format(date); } else { return new SimpleDateFormat("dd/MM", locale).format(date); } } }