得到当前日期,和当前月份的日历格式
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.util.Date;
import java.util.Scanner;
public class LocalDate{
public static void main(String[] args){
LocalDate date = LocalDate.now();
int month = date.getMonthValue();
int today = date.getDayOfMonth();
System.out.println("当前日期和时间:"+new Date());
date = date.minusDays(today - 1); //这个月的第一天
DayOfWeek weekday = date.getDayOfWeek(); //得到当前日期是星期几,作为实例返回,而不是作为数值
int value = weekday.getValue(); //星期几
System.out.println("日期后有*的为当前日期");
System.out.println("Mon Tue Wed Thu Fri Sat Sun");
for(int i = 1; i
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)