Here you can find the source of getDateString(Calendar cal)
public static String getDateString(Calendar cal)
//package com.java2s; //License from project: Apache License import java.util.Calendar; public class Main { public static String getDateString(Calendar cal) { int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONDAY) + 1; int day = cal.get(Calendar.DAY_OF_MONTH); return year + "-" + month + "-" + day; }/*from w ww .j av a 2s.c om*/ }