国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

打印日歷

2023-03-15 22:21 作者:燒死寂靜  | 我要投稿

好像可以直接plusDays(),用不著每個(gè)月都回退到第一天,下次再改了。


import java.time.LocalDate;

public class Test1 {
? ?public static void main(String[] args) {
? ? ? ?LocalDate date = LocalDate.now();
? ? ? ?int tomonth = date.getMonthValue();
? ? ? ?int today = date.getDayOfMonth();
? ? ? ?int toyear = date.getYear();
? ? ? ?date = changToOne(date);
? ? ? ?while (date.getYear() == toyear) {
? ? ? ? ? ?printMonth(date);
? ? ? ? ? ?int weekday = date.getDayOfWeek().getValue();
? ? ? ? ? ?System.out.println("Mon\tTue\tWed\tThu\tFri\tSat\tSun");
? ? ? ? ? ?for (int i = 1; i < weekday; i++) {
? ? ? ? ? ? ? ?System.out.print(" ? \t");
? ? ? ? ? ?}
? ? ? ? ? ?int month = date.getMonthValue();
? ? ? ? ? ?while (date.getMonthValue() == month) {
? ? ? ? ? ? ? ?System.out.printf("%3d", date.getDayOfMonth());
? ? ? ? ? ? ? ?if (month == tomonth && date.getDayOfMonth() == today) {
? ? ? ? ? ? ? ? ? ?System.out.print("*");
? ? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ? ? ?System.out.print("\t");
? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?if (date.getDayOfWeek().getValue() == 7) {
? ? ? ? ? ? ? ? ? ?System.out.println();
? ? ? ? ? ? ? ?}
? ? ? ? ? ? ? ?date = date.plusDays(1);
? ? ? ? ? ?}
? ? ? ? ? ?System.out.println("\n");
? ? ? ? ? ?date = changeToDayOne(date);
? ? ? ? ? ?date.plusMonths(1);
? ? ? ?}

? ?}
? ?//回退到今年首月首天
? ?public static LocalDate changToOne(LocalDate date) {
? ? ? ?int day = date.getDayOfMonth();
? ? ? ?int month = date.getMonthValue();
? ? ? ?date = date.minusDays(day - 1);
? ? ? ?date = date.minusMonths(month - 1);
? ? ? ?return date;
? ?}
? ?//回退到本月首天
? ?public static LocalDate changeToDayOne(LocalDate date) {
? ? ? ?int day = date.getDayOfMonth();
? ? ? ?return date.minusDays(day - 1);
? ?}
? ?//打印月份
? ?public static void printMonth(LocalDate date) {
? ? ? ?int month = date.getMonthValue();
? ? ? ?switch (month) {
? ? ? ? ? ?case 1 -> System.out.println("一月:");
? ? ? ? ? ?case 2 -> System.out.println("二月:");
? ? ? ? ? ?case 3 -> System.out.println("三月:");
? ? ? ? ? ?case 4 -> System.out.println("四月:");
? ? ? ? ? ?case 5 -> System.out.println("五月:");
? ? ? ? ? ?case 6 -> System.out.println("六月:");
? ? ? ? ? ?case 7 -> System.out.println("七月:");
? ? ? ? ? ?case 8 -> System.out.println("八月:");
? ? ? ? ? ?case 9 -> System.out.println("九月:");
? ? ? ? ? ?case 10 -> System.out.println("十月:");
? ? ? ? ? ?case 11 -> System.out.println("十一月:");
? ? ? ? ? ?case 12 -> System.out.println("十二月:");
? ? ? ? ? ?default -> System.out.println("erro");
? ? ? ?}
? ?}
}


打印日歷的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
德惠市| 宜州市| 兴安盟| 青阳县| 正安县| 黎城县| 微博| 千阳县| 镇巴县| 通江县| 凉城县| 夏河县| 广州市| 洪泽县| 浑源县| 亚东县| 明溪县| 游戏| 揭阳市| 孙吴县| 永善县| 磐安县| 金昌市| 泗水县| 基隆市| 霞浦县| 丽江市| 七台河市| 甘孜县| 两当县| 苏尼特左旗| 沈阳市| 龙陵县| 潼南县| 友谊县| 宁远县| 民勤县| 长白| 化德县| 历史| 白城市|