当前位置: 首页 > news >正文

赵县网站建设免费自建网站有哪些

赵县网站建设,免费自建网站有哪些,大连甘井子区政府,无锡做网站优化哪家好如何把String/Date转成LocalDateTime参考String、Date与LocalDate、LocalTime、LocalDateTime之间互转 String、Date、LocalDateTime、Calendar与时间戳之间互相转化参考String、Date、LocalDateTime、Calendar与时间戳之间互相转化 比较方法介绍 isBefore(ChronoLocalDateT…

如何把String/Date转成LocalDateTime参考String、Date与LocalDate、LocalTime、LocalDateTime之间互转

String、Date、LocalDateTime、Calendar与时间戳之间互相转化参考String、Date、LocalDateTime、Calendar与时间戳之间互相转化

比较方法介绍

isBefore(ChronoLocalDateTime<?> other):是否在other时间之前

isAfter(ChronoLocalDateTime<?> other):是否在other时间之后

isEqual(ChronoLocalDateTime<?> other):是否与other时间相等

toLocalDate().isLeapYear()

时间之间计算

方法1:采用Duration

Duration between(Temporal startInclusive, Temporal endExclusive):创建对象
toDays():endInclusive-startExclusive的天数 可正可负可为零
toHours():endInclusive-startExclusive的小时数 可正可负可为零
toMinutes(): endInclusive-startExclusive的分钟数 可正可负可为零
toMillis(): endInclusive-startExclusive的毫秒数 可正可负可为零
toNanos(): endInclusive-startExclusive的纳秒数 可正可负可为零

方法2:采用Period
Period between(LocalDate startDateInclusive, LocalDate endDateExclusive):创建对象
getYears():endDateExclusive-startDateInclusive的年 可正可负可为零
getMonths(): endDateExclusive-startDateInclusive的月 可正可负可为零
getDays() :endDateExclusive-startDateInclusive的日 可正可负可为零

具体使用:

import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.Date;/*** 测试LocalDate* @author leishen*/
public class LocalDateTest {/*** LOCAL_DATE_TIME的时间格式*/private static final DateTimeFormatter LOCAL_DATE_TIME=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss ms ns");public static void main(String[] args){//系统默认时区ZoneId zoneId = ZoneId.systemDefault();//Date-->ZonedDateTimeZonedDateTime zonedDateTime = new Date().toInstant().atZone(zoneId);//当前时间LocalDateTime now = zonedDateTime.toLocalDateTime();LocalDateTime localDateTime = LocalDateTime.of(2024, 2, 9, 14, 59,59);//isBefore(ChronoLocalDateTime<?> other):是否在other时间之前System.out.println("local.isBefore(now) = " + localDateTime.isBefore(now));//isAfter(ChronoLocalDateTime<?> other):是否在other时间之后System.out.println("local.isAfter(now) = " + localDateTime.isAfter(now));//isEqual(ChronoLocalDateTime<?> other):是否与other时间相等System.out.println("local.isEqual(now) = " + localDateTime.isEqual(now));//判断当前时间是否是闰年System.out.println("local.toLocalDate().isLeapYear() = " + localDateTime.toLocalDate().isLeapYear());System.out.println();//between(Temporal startInclusive, Temporal endExclusive)Duration duration = Duration.between(now,localDateTime);//toDays():endInclusive-startExclusive的天数 可正可负可为零System.out.println("duration.toDays() = " + duration.toDays());//toHours():endInclusive-startExclusive的小时数 可正可负可为零System.out.println("duration.toHours() = " + duration.toHours());//toMinutes(): endInclusive-startExclusive的分钟数 可正可负可为零System.out.println("duration.toMinutes() = " + duration.toMinutes());//toMillis(): endInclusive-startExclusive的毫秒数 可正可负可为零System.out.println("duration.toMillis() = " + duration.toMillis());//toNanos(): endInclusive-startExclusive的纳秒数 可正可负可为零System.out.println("duration.toNanos() = " + duration.toNanos());//between(LocalDate startDateInclusive, LocalDate endDateExclusive)Period period = Period.between(now.toLocalDate(), localDateTime.toLocalDate());//getYears() endDateExclusive-startDateInclusive的年 可正可负可为零System.out.println("period.getYears() = " + period.getYears());//getMonths() endDateExclusive-startDateInclusive的月 可正可负可为零System.out.println("period.getMonths() = " + period.getMonths());//getDays() endDateExclusive-startDateInclusive的日 可正可负可为零System.out.println("period.getDays() = " + period.getDays());}}
http://www.hrbkazy.com/news/40529.html

相关文章:

  • 有没有免费的seo网站网络广告投放网站
  • 怎么做美食的视频网站app 推广
  • 上海响应式建站semi是什么意思
  • 牛商网做网站要多少钱手机如何制作网页链接
  • 怎么给产品找关键词seo是什么东西
  • 外包网址长沙网站优化方案
  • 苏州做网站的公司有哪些如何做网站推广的策略
  • 怎么增加网站反链个人自己免费建网站
  • diy学做衣服网站建一个外贸独立站大约多少钱
  • 公司注册名字整站优化 快速排名
  • 文成网站制作google推广怎么做
  • 珠海建设网站公司汕头seo网站建设
  • 建设工程投标文件在哪个网站有发布seo排名计费系统
  • host域名主机服务商商务企业网站模板深圳十大教育培训机构排名
  • 中山网站建设文化如何2345电脑版网址导航
  • 网站开发类毕业设计北京网站推广营销服务电话
  • 北京网站设计公司地址怎么建立自己的网站平台
  • 网站建设技术课程设计报告东莞网站排名提升
  • 专门做零食批发的网站seo外链网
  • 动态网站托管山东seo网络推广
  • 烟台seo关键词排名百度快照优化排名推广怎么做
  • 深圳狮子会网站做网站推广好做吗
  • 做水果生意去那个网站长沙seo排名扣费
  • 提卡网站怎么做百度图片识别在线使用
  • 深圳横岗网站建设网络营销的四种方式
  • 怎么查网站备案域名适合交换友情链接的是
  • 企业网站建设网站优化推广郑州seo地址
  • 余姚做网站设计百度seo技术
  • 做外贸站推广重庆网站排名提升
  • 大连网站建设多少钱大型网站建设方案