learning java java.time相关类
2024-09-05 06:56:57
var clock = Clock.systemUTC();
System.out.println(clock.instant());
System.out.println(clock.millis());
System.out.println(System.currentTimeMillis());
System.out.println(clock.getZone()); var d = Duration.ofSeconds();
System.out.println(d.toDays());
System.out.println(d.toMinutes());
System.out.println(d.toHours()); var clock2 = Clock.offset(clock,d);
System.out.println(clock2.instant()); var instant = Instant.now(); System.out.println(instant); var instant2 = instant.plusSeconds();
System.out.println(instant2); System.out.println(instant.getEpochSecond());
System.out.println(instant2.getEpochSecond()); var instant3 = Instant.parse("2014-02-23T10:12:35.342Z");
var instant4 = instant3.plus(Duration.ofHours().plusMinutes());
System.out.println(instant4); var instant5 = instant4.minus(Duration.ofDays()); var localDate = LocalDate.now();
System.out.println(localDate); localDate = LocalDate.ofYearDay(,);
System.out.println(localDate); localDate = LocalDate.of(, Month.MAY,);
System.out.println(localDate); var localTime = LocalTime.now();
System.out.println(localTime); localTime = LocalTime.of(,);
System.out.println(localTime); localTime = LocalTime.ofSecondOfDay();
System.out.println(localTime); var localDateTime = LocalDateTime.now();
System.out.println(localDateTime);
var future = localDateTime.plusHours().plusMinutes();
System.out.println(future); var year = Year.now();
System.out.println(year); year = year.plusYears();
System.out.println(year); var ym = year.atMonth();
System.out.println(ym); var md = MonthDay.now();
System.out.println(md); var md2 = md.with(Month.MAY).withDayOfMonth();
System.out.println(md2);
output:
2019-07-26T01:41:36.385911400Z
1564105296390
1564105296390
Z
0
100
1
2019-07-26T03:21:36.390898600Z
2019-07-26T01:41:36.390898600Z
2019-07-26T03:21:36.390898600Z
1564105296
1564111296
2014-02-23T15:16:35.342Z
2019-07-26
2014-05-26
2014-05-21
09:41:36.406855600
23:23
01:31:43
2019-07-26T09:41:36.406855600
2019-07-27T10:44:36.406855600
2019
2024
2024-10
--07-26
--05-23
最新文章
- TensorFlow中与卷积核有关的各参数的意义
- 安装elasticsearch及中文IK和近义词配置
- MYSQL安装--小白教程
- xll调试方法
- [Python] Debugger in Pycharm
- 在Web api2 中传递复杂参数的一点心得
- Linux如何查找大文件或目录总结-1127
- 总结的一些封装好的javascript函数
- ssh key报but this does not map back to the address – POSSIBLE BREAK-IN ATTEMPT!错误
- Mysql学习(慕课学习笔记2)数据库的创建与删除
- 从linux telnet到exchange邮件server来測试发送邮件
- 应用java多线程实现server端与多client之间的通信
- Android基础知识05—活动的生命周期
- 从实战出发,谈谈 nginx 信号集
- JDBC (五)
- com.mysql.jdbc.Driver 和 com.mysql.cj.jdbc.Driver的区别
- python chardet
- Python操作MySQL案例
- k8s+Jenkins+GitLab-自动化部署asp.net core项目
- 【中文分词系列】 4. 基于双向LSTM的seq2seq字标注