Here you can find the source of dateToInt(String date)
public static int dateToInt(String date)
//package com.java2s; //License from project: Apache License public class Main { public static int dateToInt(String date) { int intDate = 0; if (date.length() == 8 && date.indexOf("-") < 0) { intDate = Integer.valueOf(date).intValue(); } else if (date.length() == 10 && date.indexOf("-") > 0) { intDate = Integer.valueOf(getYYYYMMDD(date)).intValue(); } else if (date.length() == 6 || date.length() == 4) { intDate = Integer.valueOf(date).intValue(); }/* ww w. j a v a 2 s . co m*/ return intDate; } public static String getYYYYMMDD(String date) { String YYYYMMDD = ""; YYYYMMDD = date.substring(0, 4) + date.substring(5, 7) + date.substring(8); return YYYYMMDD; } }