Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static String formatNoaaForCalendar(Calendar c) { return "" + c.get(Calendar.YEAR) + "-" + String.format("%02d", (c.get(Calendar.MONTH) + 1)) + "-" + String.format("%02d", c.get(Calendar.DATE)); } }