2020国产成人精品视频,性做久久久久久久久,亚洲国产成人久久综合一区,亚洲影院天堂中文av色

分享

JavaSE常用類之Instant類及常用方法

 Coder編程 2022-12-24 發(fā)布于北京

Instant 類的使用

Instant 類概述

在時間線上的瞬間點。該類在時間線上建立單個瞬時點。 這可能用于在應用程序中記錄事件時間戳。

now( ) 方法

//now() 獲取本初子午線的時間
Instant instant = Instant.now();
System.out.println(instant);      //中時區(qū)		2021-03-09T02:02:46.596Z

atOffset( ) 方法添加時間偏移量

//添加時間偏移量
OffsetDateTime offsetDateTime = instant.atOffset(ZoneOffset.ofHours(8));
System.out.println(offsetDateTime);       //東八區(qū)		2021-03-09T10:02:46.596+08:00

toEpochMilli( ) 方法獲取時間戳

long milli = instant.toEpochMilli();
System.out.println(milli);		//1615255366596

ofEpochMilli( ) 方法通過時間戳獲取時間

//通過時間戳獲取時間 ----- 本初子午線的時間
Instant instant1 = Instant.ofEpochMilli(1615198793505L);
System.out.println(instant1);		//2021-03-08T10:19:53.505Z

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多