下面是该法典(我可以稍微加以改进,但乌可以提出想法)。
import java.util.*;
import java.lang.*;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
java.text.SimpleDateFormat sdf =
new java.text.SimpleDateFormat(DATE_FORMAT);
Calendar c=Calendar.getInstance();
c.setTimeInMillis(0);//reset to epoch
System.out.println(c.getTime());
Date d=new Date(1970,6,10);
Calendar inputDate=Calendar.getInstance();
inputDate.setTime(d);
while(c.before(inputDate))
{
c.add(Calendar.DATE,3);
System.out.println(sdf.format(c.getTime()));
}
}
}
Sampleî here