Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String DataToInt(Date dateImg) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); String strDate = sdf.format(dateImg); String[] strs = strDate.split("/"); int[] ints = { Integer.parseInt(strs[0]), Integer.parseInt(strs[1]), Integer.parseInt(strs[2]) }; return ints[0] + "-" + ints[1] + "-" + ints[2]; } }