LocalDate日期类(开发笔记)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_34246546/article/details/82627155
package com.xc.test3;

import java.time.Duration;
import java.time.LocalDate;
import java.time.temporal.Temporal;
import java.time.temporal.TemporalAmount;
import java.time.temporal.TemporalUnit;
import java.util.List;
import java.util.Random;

public class MapTest {

	
		public static void main(String[] args) {
			
//			Random rand = new Random();
//			int a =rand.nextInt(2);
			
			LocalDate localDate=LocalDate.now();
			
			//当前月份 SEPTEMBER
			System.out.println("localDate.getMonth():    "+localDate.getMonth());
			//当前年月日 xxxx-xx-xx
			System.out.println("localDate:    "+localDate);
			//当前月份的第多少天
			System.out.println("localDate.getDayOfMonth():    "+localDate.getDayOfMonth());
			//当前年的第多少天
			System.out.println("localDate.getDayOfYear():    "+localDate.getDayOfYear());
			//加多少天后的年月日xxxx-xx-xx
			System.out.println("localDate.plusDays(1000):    "+localDate.plusDays(1000));
			
			
		}
}
localDate.getMonth():    SEPTEMBER
localDate:    2018-09-11
localDate.getDayOfMonth():    11
localDate.getDayOfYear():    254
localDate.plusDays(1000):    2021-06-07

猜你喜欢

转载自blog.csdn.net/qq_34246546/article/details/82627155