Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static String buildDateForUrl(Calendar calendar) { String day = (calendar.get(Calendar.DAY_OF_MONTH) < 10 ? "0" : "") + calendar.get(Calendar.DAY_OF_MONTH); String month = ((calendar.get(Calendar.MONTH) + 1) < 10 ? "0" : "") + (calendar.get(Calendar.MONTH) + 1); return calendar.get(Calendar.YEAR) + "" + month + "" + day; } }