Here you can find the source of formatDate(Calendar date)
public static String formatDate(Calendar date)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.TimeZone; public class Main { private static final SimpleDateFormat DAY_FORMAT = new SimpleDateFormat("dd-MM-yyyy") { {/*from ww w . j ava2 s . c o m*/ setTimeZone(TimeZone.getTimeZone("UTC")); } }; public static String formatDate(Calendar date) { return DAY_FORMAT.format(date.getTime()); } }