Java tutorial
//package com.java2s; import java.util.Date; public class Main { public static String date2calendarStr(Date date) { return date2calendarStr(date.getYear() + 1900, date.getMonth() + 1, date.getDate()); } public static String date2calendarStr(int year, int month, int day) { return year + "-" + month + "-" + day; } }