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

网络工程专业是什么做优化排名会不会影响网站速度

网络工程专业是什么,做优化排名会不会影响网站速度,高端网站设计公司排名,如何做平台软件新日期时间API出现的背景 jdk8之前时间日期API 如果我们可以跟别人说#xff1a;“我们在1502653933071见面#xff0c;别晚了#xff01;”那么就再简单不过了。但是我们希望时间与昼夜和四季有关#xff0c;于是事情就变复杂了。jdk 1.0中包含了一个java.util.Date类“我们在1502653933071见面别晚了”那么就再简单不过了。但是我们希望时间与昼夜和四季有关于是事情就变复杂了。jdk 1.0中包含了一个java.util.Date类但是它大多数方法已经在jdk 1.1引入Calendar类之后被弃用了。而Calendar并不比Date好多少。它们面临的问题是 可变性像日期和时间这样的类应该是不可变的。 偏移性Date中的年份是从1900开始的而月份都从0开始。 格式化格式化只对Date有用Calendar则不行。 此外它们也不是线程安全的不能处理闰秒等。 新时间日期API java 8吸收了 joda-Time 的精华以一个新的开始为java创建优秀的API。新的 java.time 中包含了所有关于本地日期(LocalDate)、本地时间(LocalTime)、本地日期时间(LocalDateTime)、时区(ZonedDateTime)和持续时间(Duration) 的类。历史悠久的 Date 类新增了 toInstant() 方法用于把 Date 转换成新的表示形式。这些新增的本地化时间日期API大大简化了日期时间和本地化的管理。 注 joda-Time提供了一组java类包用于处理包括ISO8601标准在内的date和time可以利用它把jdk Date和Calendar类完全替换掉而且仍然能够提供很好的集成目前joda-Time已经纳入 jdk 8 的官方API了。 LocalDateLocalTImeLocalDateTime 1、LocalDateTime相较于LocalDate、localTime使用频率要高 2、类似于Calendar //now():获取当前日期、时间、日期时间 -----------实例化方式一LocalDate localDate LocalDate.now();LocalTime localTime LocalTime.now();LocalDateTime localDateTime LocalDateTime.now();System.out.println(localDate);//2020-04-14System.out.println(localTime);//15:31:53.209System.out.println(localDateTime);//2020-04-14T15:31:53.209//Of():设置指定的年月日时分秒,是没有偏移量的 -----------实例化方式二LocalDateTime localDateTime1 LocalDateTime.of(2012, 2, 2, 13, 14);System.out.println(localDateTime1);//2012-02-02T13:14//getXxx():获取相关属性System.out.println(localDateTime1.getDayOfMonth());//2System.out.println(localDateTime1.getDayOfWeek());//THURSDAYSystem.out.println(localDateTime1.getMonth());//FEBRUARYSystem.out.println(localDateTime1.getMinute());//14//体现不可变性//WithXxx():设置相关属性LocalDateTime localDateTime2 localDateTime1.withDayOfMonth(15);System.out.println(localDateTime1);//2012-02-02T13:14System.out.println(localDateTime2);//2012-02-15T13:14LocalDateTime localDateTime3 localDateTime1.withMinute(50);System.out.println(localDateTime3);//2012-02-02T13:50//plusXxx():加LocalDateTime localDateTime4 localDateTime1.plusMonths(5);System.out.println(localDateTime1);//2012-02-02T13:14System.out.println(localDateTime4);//2012-07-02T13:14//minusXxx():减LocalDateTime localDateTime5 localDateTime1.minusDays(1);System.out.println(localDateTime1);//2012-02-02T13:14System.out.println(localDateTime5);//2012-02-01T13:14瞬时Instant(类似于java.util.Date) Instant时间线上的一个瞬时点。这可能被用来记录应用程序中的事件时间戳。 在处理时间和日期的时候我们通常会想到年月日时分秒。然而这只是时间的一个模型是面向人类的。第二种通用模型是面向机器的或者说是连续的。在此模型中时间线中的一个点表示为一个很大的数这有利于计算机处理。在UNIX中这个数从1970年开始以秒为单位同样的在java中也是从1970年开始但以毫秒为单位。 java.time包通过值类型Instant提供机器视图不提供处理人类意义上的时间单位。Instant表示时间线上的一点而不需要任何上下文信息例如时区。概念上讲它只是简单的表示自1970年1月1日0时0分0秒(UTC)开始的秒数。因为java.time包是基于纳秒计算的所以Instant的精度可以达到纳秒级。 public void test2(){//now():获取本初子午线对应的时间标准Instant instant Instant.now();System.out.println(instant);//2020-04-14T13:02:26.572Z 这个时间是本初子午线的时间与我们使用的不同需要添加偏移量//添加时间偏移量OffsetDateTime offsetDateTime instant.atOffset(ZoneOffset.ofHours(8));System.out.println(offsetDateTime);//2020-04-14T21:04:54.99208:00//toEpochMilli()获取自1970年1月1日0时0分0秒(UTC)开始的毫秒数 ----Date类的getTime()long l instant.toEpochMilli();System.out.println(l);//1586869726432//ofEpochMilli():通过给定的毫秒数获取Instant ---Date(long millis)Instant instant1 Instant.ofEpochMilli(1586869726432L);System.out.println(instant1);}DateTimeFormatter格式化与解析日期或时间 public void test3(){//方式一不常用// 预定义的标准格式。如ISO_LOCAL_DATE_TIME;ISO_LOCAL_DATE;ISO_LOCAL_TIMEDateTimeFormatter formatter DateTimeFormatter.ISO_LOCAL_DATE_TIME;//格式化:日期--字符串LocalDateTime localDateTime LocalDateTime.now();String str1 formatter.format(localDateTime);System.out.println(localDateTime);//2020-04-14T21:24:58.608System.out.println(str1);//2020-04-14T21:24:58.608//解析字符串 --日期TemporalAccessor parse formatter.parse(2020-04-14T21:24:58.608);System.out.println(parse);//方式二不常用//本地化相关的格式。如ofLocalizedDateTime()//FormatStyle.LONG / FormatStyle.MEDIUM / FormatStyle.SHORT :适用于LocalDateTimeDateTimeFormatter formatter1 DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG);//格式化String str2 formatter1.format(localDateTime);System.out.println(str2);//2020年4月14日 下午09时32分27秒//本地化相关的格式。如ofLocalizedDate()// FormatStyle.FULL / FormatStyle.LONG / FormatStyle.MEDIUM / FormatStyle.SHORT :适用于LocalDateTimeDateTimeFormatter formatter2 DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL);String str3 formatter2.format(LocalDate.now());System.out.println(str3);//2020年4月14日 星期二//方式三常用// 自定义的格式。如ofPattern(yyyy-MM-dd hh:mm:ss E)DateTimeFormatter formatter3 DateTimeFormatter.ofPattern(yyyy-MM-dd hh:mm:ss);//格式化String str4 formatter3.format(LocalDateTime.now());System.out.println(str4);//2020-04-14 09:38:41//解析TemporalAccessor accessor formatter3.parse(2020-04-14 09:38:41);System.out.println(accessor);//{MicroOfSecond0, MilliOfSecond0, SecondOfMinute41, HourOfAmPm9, MinuteOfHour38, NanoOfSecond0},ISO resolved to 2020-04-14}其他时间API 还有很多
http://www.hkea.cn/news/14480303/

相关文章:

  • 企业网站哪家公司好seo课程简介
  • 高质量网站外链平台利用html做博客网站
  • 广州我要做网站我的世界做图片的网站
  • 互联网门户网站模板网站建设 职责
  • 互联网网站 数据库wordpress登录用添加验证码
  • 青岛哪家做网站好wordpress主题添加logo图片
  • 深圳建设工程协会网站科技龙头股一览表
  • 杭州公司网站域名续费问医生免费咨询
  • 做公司自主网站微信小程序游戏手游排行榜
  • 东阳市网站建设wordpress首页如何添加模块
  • 在线网站代码生成器ui设计已经不火了
  • 合肥专业网站优化价格哪里学网站开发
  • 中國無法訪問wordpress免费的关键词优化工具
  • 做网站什么框架方便男女做暖暖的试看网站
  • 个人网站作品下载一个ip可以做几个网站
  • 专业网站建站wordpress登录不上后台
  • 台州网站怎么推广电商运营推广的方式和渠道有哪些
  • 怎么用h5网站做动效oa电子办公系统
  • 公司网站建设接单安徽网站制作公司
  • 汕头自助建站软件三维家设计官网
  • 如何搜索网站的内容大兴区网站建设公司
  • 北京移动网站建设公司排名福州百度网站排名优化
  • 影视传媒网站源码为什么那么多人建网站做博客
  • 重庆公司网站设计制作贵州省城乡和住房建设厅网站
  • 做水果网站用什么域名seo蒙牛伊利企业网站专业性诊断
  • 程序员接活的平台网站做网站的分工
  • 黄冈网站推广软件下载注册小程序要多少钱
  • 做国际网站阿里巴巴网上购物商城系统er图
  • 做微信头图的网站请人做网站谁来维护
  • 网站可以做固定资产吗在建项目人员查询网站