Here you can find the source of dateToNumber(Date date)
public static final Long dateToNumber(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static final Long dateToNumber(Date date) { if (date == null) { return null; }//from w ww. jav a 2 s . 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); } }