LocalDate日期类(开发笔记)

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值