Here you can find the source of dateToNumber(Date date)
public static final Long dateToNumber(Date date)
//package com.java2s; import java.util.*; public class Main { public static final Long dateToNumber(Date date) { if (date == null) { return null; }/*from w w w. jav a 2s. c o m*/ Calendar c = Calendar.getInstance(); c.setTime(date); String month; String day; if ((c.get(Calendar.MONTH) + 1) >= 10) { month = "" + (c.get(Calendar.MONTH) + 1); } else { month = "0" + (c.get(Calendar.MONTH) + 1); } if (c.get(Calendar.DATE) >= 10) { day = "" + c.get(Calendar.DATE); } else { day = "0" + c.get(Calendar.DATE); } String number = c.get(Calendar.YEAR) + "" + month + day; return new Long(number); } }