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

礼品网站建设建筑工程信息频道

礼品网站建设,建筑工程信息频道,网站费用多少,地方购物网站盈利模式如何把String/Date转成LocalDateTime参考String、Date与LocalDate、LocalTime、LocalDateTime之间互转 String、Date、LocalDateTime、Calendar与时间戳之间互相转化参考String、Date、LocalDateTime、Calendar与时间戳之间互相转化 方法介绍 withYear(int year) 指定日期的…如何把String/Date转成LocalDateTime参考String、Date与LocalDate、LocalTime、LocalDateTime之间互转 String、Date、LocalDateTime、Calendar与时间戳之间互相转化参考String、Date、LocalDateTime、Calendar与时间戳之间互相转化 方法介绍 withYear(int year) 指定日期的年 withMonth(int month) 指定日期的月 范围1-12 withDayOfMonth(int dayOfMonth) 指定日期是月中的第几天 范围1 - 28/31 withDayOfYear(int dayOfYear) 指定日期是年中的第几天 范围1 - 365/366 withHour(int hour) 指定日期的小时 范围0 - 23 withMinute(int minute) 指定日期的分钟 范围0 - 59 withSecond(int second) 指定日期的秒 范围0 - 59 withNano(int nanoOfSecond) 指定日期中纳秒 具体使用 import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Date;/*** 测试LocalDate* author leishen*/ public class LocalDateTest {/*** LOCAL_DATE_TIME的时间格式*/private static final DateTimeFormatter LOCAL_DATE_TIMEDateTimeFormatter.ofPattern(yyyy-MM-dd HH:mm:ss ms ns);/*** DATE_TIME的时间格式*/private static final SimpleDateFormat DATE_TIMEnew SimpleDateFormat(yyyy-MM-dd HH:mm:ss ms);public static void main(String[] args) {//系统默认时区ZoneId zoneId ZoneId.systemDefault();//Date--ZonedDateTimeZonedDateTime zonedDateTime new Date().toInstant().atZone(zoneId);LocalDateTime localDateTime zonedDateTime.toLocalDateTime();System.out.println(localDateTime.format(LOCAL_DATE_TIME) localDateTime.format(LOCAL_DATE_TIME));//withYear(int year) 指定日期的年localDateTime localDateTime.withYear(2022);System.out.println(localDateTime.withYear(2022) localDateTime.format(LOCAL_DATE_TIME));//withMonth(int month) 指定日期的月 范围1-12localDateTime localDateTime.withMonth(1);System.out.println(localDateTime.withMonth(1) localDateTime.format(LOCAL_DATE_TIME));//withDayOfMonth(int dayOfMonth) 指定日期是月中的第几天 范围1 - 28/31localDateTime localDateTime.withDayOfMonth(1);System.out.println(localDateTime.withDayOfMonth(1) localDateTime.format(LOCAL_DATE_TIME));//withDayOfYear(int dayOfYear) 指定日期是年中的第几天 范围1 - 365/366localDateTime localDateTime.withDayOfYear(60);System.out.println(localDateTime.withDayOfYear(60) localDateTime.format(LOCAL_DATE_TIME));//withHour(int hour) 指定日期的小时 范围0 - 23localDateTime localDateTime.withHour(23);System.out.println(localDateTime.withHour(23) localDateTime.format(LOCAL_DATE_TIME));//withMinute(int minute) 指定日期的分钟 范围0 - 59localDateTime localDateTime.withMinute(59);System.out.println(localDateTime.withMinute(59) localDateTime.format(LOCAL_DATE_TIME));//withSecond(int second) 指定日期的秒 范围0 - 59localDateTime localDateTime.withSecond(59);System.out.println(localDateTime.withSecond(59) localDateTime.format(LOCAL_DATE_TIME));//withNano(int nanoOfSecond) 指定日期中纳秒localDateTime localDateTime.withNano(0);System.out.println(localDateTime.withNano(0) localDateTime.format(LOCAL_DATE_TIME));Date date Date.from(localDateTime.atZone(zoneId).toInstant());System.out.println(DATE_TIME.format(date) DATE_TIME.format(date));} }
http://www.dnsts.com.cn/news/215967.html

相关文章:

  • 找装修公司去哪个网站硬件开发工程师需要掌握的专业知识
  • 南昌简单做网站汕头模板建站流程
  • 东莞网站建设哪家公司好英文网站怎么建
  • 新手怎么优化网站pc网站开发微信支付
  • 做网站哪种字体好看知雅汇网页设计实训报告
  • 专业网站建设哪家好帮忙做任务网站
  • 泰安放心的企业建站公司腾讯云建站平台
  • 宁波品牌网站公司排名响应式网站微博视频教程
  • 哪些网站做企业招聘不要花钱photoshop基础入门教程
  • wordpress优秀模板下载域名优化在线
  • 网站建设分为几类网站meta网页描述
  • 个人建什么样的网站广州网站制作建设
  • 网站之家动画制作网页
  • 网站设计宽屏车载网络设计是干什么的
  • 物流信息网站建设网页制作与设计属于
  • 网站建设 杭州市萧山区广州一点网络科技有限公司
  • 禹城网站建设电话网站打开是404
  • 吉安网页制作公司wordpress优化软件
  • 德州极速网站建设小程序二建注册信息查询系统官网
  • 网站pc和手机端网站可以微信支付是怎么做的
  • 免费网站专业建站网站建设 职责
  • 快速建站服务器网站建设排行
  • 天津市城乡建设网站服务商平台登录
  • wap卖料建站系统商丘做网站哪家好
  • 大连企业网站模板做网站和做网页有什么区别
  • 做视频网站需要什么证件网站标签化
  • 国内十大网站制作公司怎么通过数据库做网站的登录
  • 现在都有什么网站工作室闸北东莞网站建设
  • 网站如何吸引人照片书哪家网站做的好
  • 蓝山网站建设西安有哪些网站建设公司