Java examples for java.util:Day
get Some Day Date
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] argv) throws Exception { int N = 2; System.out.println(getSomeDayDate(N)); }//from w w w .j a v a 2 s .com public static String getSomeDayDate(int N) { Date now = new Date(); long time = now.getTime() / 1000 + N * 86400; DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String date = format.format(new Date(time * 1000l)); return date.replaceAll("-", ""); } }