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

稿定设计网站官网入口郴州市第一职业中专

稿定设计网站官网入口,郴州市第一职业中专,国外网络推广公司,504 wordpress1.localDateTime类格式化和解析 概念 #xff08;1#xff09;格式化:把localDateTime对象转换为String,需通过DateTimeFormatter对象指定格式 #xff08;2#xff09;解析:把String转换为localDateTime对象,需通过DateTimeFormatter对象指定格式 注#xff1a;localDat…1.localDateTime类格式化和解析 概念 1格式化:把localDateTime对象转换为String,需通过DateTimeFormatter对象指定格式 2解析:把String转换为localDateTime对象,需通过DateTimeFormatter对象指定格式 注localDateTime使用parse解析时键盘录入需要格式完全一致如8月输入08而JDK7中的解析输入8即可。 public class Demo4 {public static void main(String[] args) {LocalDateTime ldt LocalDateTime.now();System.out.println(--------------格式化-------------------);//localDateTime对象调用format(参数为DateTimeForTime对象)//String str ldt.format(DateTimeFormatter.ofPattern(yyyy-MM-dd HH:mm:ss));DateTimeFormatter dateTimeFormatter DateTimeFormatter.ofPattern(yyyy-MM-dd HH:mm:ss);String str ldt.format(dateTimeFormatter);// DateTimeForTime类调用ofPattern(同时设置时间格式)静态方法得到对象System.out.println(str);System.out.println(---------------解析-------------------);// localDateTime类名调用parse(同时设置时间格式)方法//LocalDateTime parse ldt.parse(str, DateTimeFormatter.ofPattern(yyyy-MM-dd HH:mm:ss));LocalDateTime parse ldt.parse(str, dateTimeFormatter);//注意,解析的对象精度必须和解析一致System.out.println(parse);//parse为LocalDateTime对象可调用方法);} }打印结果 ------------------------------------------------------------ 2021-06-29 21:32:00 2021-06-29T21:322.localDateTime类与localDate类、localDateTime类的转化 //localDateTime[天时分秒]转换为 // localDate[精度为天] localTime[精度为时分秒] public class Demo3 {public static void main(String[] args) {LocalDateTime ldt LocalDateTime.of(2020, 10, 10, 10, 10, 10);// localDate[精度为天]LocalDate localDate ldt.toLocalDate();//localTime[精度为时分秒]LocalTime localTime ldt.toLocalTime();System.out.println(localDate);System.out.println(localTime);} }打印结果 ------------------------------------------------------------- 2020-10-10 10:10:10
http://www.pierceye.com/news/5809/

相关文章:

  • 福州做网站互联网公司排名怎么查网站做404页面没
  • 电脑网站自适应怎么做顾客评价网站
  • 北京网站设计的公司价格东莞神马seo推广排名
  • WordPress挂在虚拟站点吴江seo排名
  • 营销网站建设企业建企业网站哪个平台好
  • 自助建站好吗杭州百度竞价推广公司
  • 在线做原型的网站集团企业网站设计方案
  • 三门峡网站建设推广怎样建设淘客网站
  • 对我单位网站进行改版汪峰做的音乐网站
  • 防盗报警网站建设设置网站404页面
  • 在网站后台管理系统里产品说明怎么添加图片ICP网站忘记密码
  • 网站使用前流程海外房产网站建设
  • 网站集约化建设探讨wordpress右侧链接
  • 什么是推广型网站网站正在备案
  • 服装网站建设配色大连app网站建设
  • 中讯高科网站建设连锁餐饮网站开发背景内容
  • 大连市住房与城乡建设部网站生鲜市场型网站开发
  • 哪个网站做效果图好百度网盘pc端网页版
  • 网站开发 入门端午节ppt模板免费下载
  • 绍兴网站seowordpress信息搜集
  • html设计主题网站代码做视频网站视频的软件
  • 设计合理的网站网页归档wordpress videopro汉化
  • 建设高校实验室教学网站的作用西安市建设工程信息网官网
  • 单人做网站兰州哪家网站做推广效果好
  • 广州网站制作开发公司界面做的比较好的网站
  • 需要做网站建设和推广的行业重庆品牌logo设计
  • seo网站关键词排名软件正规网店代运营公司
  • 重庆网站开发设计公司电话智能科技网站模板下载
  • 手机定制网站建设微信、网站提成方案点做
  • 深圳网站建设企业网站模板哪个网站全面