Here you can find the source of dateFormat(String strYear, String strMonth, String strDay)
static public String dateFormat(String strYear, String strMonth, String strDay)
//package com.java2s; public class Main { static public String dateFormat(String strYear, String strMonth, String strDay) { if (strYear == null || strYear.equals("")) return ""; if (strMonth == null || strMonth.equals("")) return ""; if (strDay == null || strDay.equals("")) return ""; strYear = strYear.trim();// year must be 4 digits. strMonth = strMonth.trim();/*w w w .j a v a2 s . c o m*/ if (strMonth.length() == 1) strMonth = "0" + strMonth; strDay = strDay.trim(); if (strDay.length() == 1) strDay = "0" + strDay; String strDate = strYear + strMonth + strDay; return strDate; } }