Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getDateString(int year, int month, int day) { Calendar c = Calendar.getInstance(); c.set(year, month, day); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); return sdf.format(c.getTime()); } }