Android examples for java.util:Year
get Time Form year, month, day
import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import java.text.SimpleDateFormat; import java.util.Date; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static String getTimeForm(int year, int month, int day, String separator) {//from w ww . j a v a2s . co m StringBuilder builder = new StringBuilder(); builder.append(year); if (separator != null) { builder.append(separator); } builder.append((month + 1) < 10 ? "0" + (month + 1) : (month + 1)); if (separator != null) { builder.append(separator); } builder.append((day < 10) ? "0" + day : day); return builder.toString(); } }