Here you can find the source of toYYYYMMDD(Calendar cal)
public static String toYYYYMMDD(Calendar cal)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /** Formatteur de date */ private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); public static String toYYYYMMDD(Calendar cal) { return sdf.format(cal.getTime()); }/*from w w w .ja va2 s .c o m*/ }