Android examples for java.util:Year
format Date as year/month/day format
import android.text.TextUtils; import android.widget.TextView; import java.util.Calendar; public class Main{ public static String formatDate(int year, int monthOfYear, int dayOfMonth) { return year + "/" + monthOfYear + "/" + dayOfMonth; }/* www . j a v a2 s . c om*/ public static String formatDate(Calendar calendar) { return formatDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH)); } }