Java tutorial
//package com.java2s; //License from project: LGPL import java.text.SimpleDateFormat; import java.util.Date; import java.util.GregorianCalendar; public class Main { private static final SimpleDateFormat mFormat = new SimpleDateFormat("yyyy-MM-dd"); /** * returns the string representation of the current date in the appropriate format for the URL * @return string representation of the current date */ public static String getTodayUrlTimeString() { return getUrlTimeString(new GregorianCalendar()); } /** * returns the string representation of the passed GregorianCalendar * in the appropriate format for the URL * @param _cal the calendar to use the date from * @return string representation of the passed date */ public static String getUrlTimeString(GregorianCalendar _gc) { return getUrlTimeString(_gc.getTime()); } public static String getUrlTimeString(Date _d) { return mFormat.format(_d); } }