SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); long starttemp = (start/1000) - 3600*24; for(i=0;i<beforeday try tempday='sdf.parse("2002-02-28");' tempday2="1000*3600*24*i" start sdf.format starttemp="starttemp" ss="sdf.format(1000*starttemp);" catch e e.printstacktrace></beforeday>