import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Test { public static void main(String[] args) throws ParseException { //当前时间 Date now = new Date(); SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); //Date转换成String System.out.println(df.format(now)); //String转换成Date Date daTime=df.parse(df.format(now)); long longTime; //年月日转换成时间戳 longTime = daTime.getTime(); System.out.println(longTime); //时间戳增加24小时转换成年月日 long lt = longTime+24*3600*1000; Date date = new Date(lt); String res = df.format(date); System.out.println(res); } }