Here you can find the source of DateToMask(Date javaDateType)
public static String DateToMask(Date javaDateType)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static String DateToMask(Date javaDateType) { Calendar dt = Calendar.getInstance(); dt.setTime(javaDateType);//from w w w . java2s . c om String dia = String.valueOf(dt.get(Calendar.DAY_OF_MONTH)); String mes = String.valueOf(dt.get(Calendar.MONTH) + 1); String ano = String.valueOf(dt.get(Calendar.YEAR)); while (dia.length() < 2) { dia = "0".concat(dia); } while (mes.length() < 2) { mes = "0".concat(mes); } while (ano.length() < 4) { ano = "0".concat(ano); } return dia.concat("/").concat(mes).concat("/").concat(ano); } }