Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static String calendar2str(Calendar c) { int year = c.get(Calendar.YEAR); int month = c.get(Calendar.MONTH) + 1; int day = c.get(Calendar.DAY_OF_MONTH); return year + "-" + month + "-" + day; } }