import java.util.Calendar
import java.util.Locale
public class Test
{
public static void main(String[] args)
{
Calendar calendar = Calendar.getInstance()
calendar.set(2020, 0, 1)
// 日~六
// 1~7
int desc = 6 - calendar.get(Calendar.DAY_OF_WEEK)
calendar.add(Calendar.DAY_OF_WEEK, desc)
System.out.format(Locale.CHINA, "%1$tY年%1$tm月%1$td号%1tA", calendar)
}
}
Calendar calendar = new GregorianCalendar()//抽象类java.util.Calendar 和它的一个具体子类,java.util.GregorianCalendarDate trialTime = new Date()
calendar.setTime(trialTime)
calendar.set(GregorianCalendar.DAY_OF_WEEK,
GregorianCalendar.FRIDAY)//设置成Friday
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)