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

石家庄网站开发网络营销的主要内容有哪些

石家庄网站开发,网络营销的主要内容有哪些,这几年做哪个网站能致富,我想在百度上做广告怎么做Java日期工具类LocalDateTime 嘚吧嘚LocalDateTime - API创建时间获取年月日时分秒增加时间减少时间替换时间日期比较 嘚吧嘚 压轴的来了,个人感觉LocalDateTime是使用频率最高的工具类,所以本篇像文章详细研究说明一下🧐。 如果看了Java日期…

Java日期工具类LocalDateTime

  • 嘚吧嘚
  • LocalDateTime - API
    • 创建时间
    • 获取年月日时分秒
    • 增加时间
    • 减少时间
    • 替换时间
    • 日期比较

嘚吧嘚

压轴的来了,个人感觉LocalDateTime是使用频率最高的工具类,所以本篇像文章详细研究说明一下🧐。
如果看了Java日期工具类LocalDate和Java时间工具类LocalTime👍,那么本篇文章就算是一个整合、进阶吧😎。

LocalDateTime - API

创建时间

函数声明描述
static LocalDateTime now()获取默认时区的当前日期时间
static LocalDateTime now(ZoneId zone)获取指定时区的当前日期时间
static LocalDateTime now(Clock clock)从指定时钟获取当前日期时间
static LocalDateTime of(LocalDate date, LocalTime time)根据日期和时间对象获取LocalDateTime对象
static LocalDateTime of(int year, Month month, int dayOfMonth, int hour, int minute, int second)根据指定的年、月、日、时、分、秒获取LocalDateTime实例

LocalDateTime now()

获取指定时区、时钟的日期时间就不多做说明了,和LocalDate一样。

// 获取当前时间
LocalDateTime now = LocalDateTime.now();
System.out.println("now : " + now);
// 格式化
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String nowStr = now.format(formatter);
System.out.println("nowStr : " + nowStr);

在这里插入图片描述
LocalDateTime of()
在这里插入图片描述

获取年月日时分秒

函数声明描述
int getYear()获取年份
Month getMonth()获取月份,返回值为月份的枚举
int getMonthValue()获取月份,返回值为int类型月份
DayOfWeek getDayOfWeek()获取日期是星期几
int getDayOfMonth()获取日期在该月是第几天
int getDayOfYear()获取日期在该年是第几天
int getHour()获取小时
int getMinute()获取分钟
int getSecond()获取秒钟
int getNano()获取纳秒
LocalDateTime now = LocalDateTime.now();
// 获取年
System.out.println("getYear : " + now.getYear());
// 获取月份
System.out.println("getMonth : " + now.getMonth());
System.out.println("getMonthValue : " + now.getMonthValue());
// 获取日
System.out.println("getDayOfWeek : " + now.getDayOfWeek());
System.out.println("getDayOfMonth : " + now.getDayOfMonth());
System.out.println("getDayOfYear : " + now.getDayOfYear());
// 获取小时
System.out.println("getHour : " + now.getHour());
// 获取分钟
System.out.println("getMinute : " + now.getMinute());
// 获取秒
System.out.println("getSecond : " + now.getSecond());
// 获取纳秒
System.out.println("getNano : " + now.getNano());

在这里插入图片描述

增加时间

虽然是增加时间,传参可为正数,也可为负数。传参为正数时增加,传参为负数时减少。

函数声明描述
LocalDateTime plusYears(long years)增加年
LocalDateTime plusMonths(long months)增加月份
LocalDateTime plusWeeks(long weeks)增加周
LocalDateTime plusDays(long days)增加日
LocalDateTime plusHours(long hours)增加小时
LocalDateTime plusMinutes(long minutes)增加分钟
LocalDateTime plusSeconds(long seconds)增加秒
LocalDateTime plusNanos(long nanos)增加纳秒

增加年、月、周、日

LocalDateTime now = LocalDateTime.now();
System.out.println("now:" + now);
// 修改年份
System.out.println("plusYears : " + now.plusYears(1));
System.out.println("plusYears : " + now.plusYears(-1));
// 修改月份
System.out.println("plusMonths : " + now.plusMonths(1));
System.out.println("plusMonths : " + now.plusMonths(-2));
// 修改周
System.out.println("getDayOfWeek : " + now.plusWeeks(1));
System.out.println("getDayOfWeek : " + now.plusWeeks(-2));
// 修改日
System.out.println("plusDays : " + now.plusDays(3));
System.out.println("plusDays : " + now.plusDays(-3));

在这里插入图片描述

增加时、分、秒、纳秒

        LocalDateTime now = LocalDateTime.now();System.out.println("now:" + now);// 修改小时System.out.println("plusHours : " + now.plusHours(2));System.out.println("plusHours : " + now.plusHours(-5));// 修改分钟System.out.println("plusMinutes : " + now.plusMinutes(20));System.out.println("plusMinutes : " + now.plusMinutes(-15));// 修改秒System.out.println("plusSeconds : " + now.plusSeconds(11));System.out.println("plusSeconds : " + now.plusSeconds(-31));// 修改纳秒System.out.println("plusNanos : " + now.plusNanos(53));System.out.println("plusNanos : " + now.plusNanos(-63));

在这里插入图片描述

减少时间

虽然是减少时间,传参可为正数,也可为负数。传参为正数时减少,传参为负数时增加。

函数声明描述
LocalDateTime minusYears(long years)减少年
LocalDateTime minusMonths(long months)减少月份
LocalDateTime minusWeeks(long weeks)减少周
LocalDateTime minusDays(long days)减少日
LocalDateTime minusHours(long hours)减少小时
LocalDateTime minusMinutes(long minutes)减少分钟
LocalDateTime minusSeconds(long seconds)减少秒
LocalDateTime minusNanos(long nanos)减少纳秒

减少其实也是调用的增加的方法
在这里插入图片描述
以减少年为例

LocalDateTime now = LocalDateTime.now();
System.out.println("now:" + now);
// 减少年
System.out.println("minusYears : " + now.minusYears(2));
System.out.println("minusYears : " + now.minusYears(-5));

在这里插入图片描述

替换时间

函数声明描述
LocalDateTime withYear(int year)替换年(-999999999-999999999)
LocalDateTime withMonth(int month)替换月份(1-12)
LocalDateTime withDayOfMonth(int dayOfMonth)替换为本月中的第几天(1-31)
LocalDateTime withDayOfYear(int dayOfYear)替换为本年中的第几天(1-366)
LocalDateTime withHour(int hour)替换小时(0-23)
LocalDateTime withMinute(int minute)替换分钟(0-59)
LocalDateTime withSecond(int second)替换秒(0-59)
LocalDateTime withNano(int nanoOfSecond)替换纳秒(0-999999999)
LocalDateTime now = LocalDateTime.now();
System.out.println("now:" + now);
// 替换年
System.out.println("withYear : " + now.withYear(1996));
// 替换月
System.out.println("withMonth : " + now.withMonth(5));
// 替换日
System.out.println("withDayOfMonth : " + now.withDayOfMonth(5));
System.out.println("withDayOfYear : " + now.withDayOfYear(5));
// 替换时
System.out.println("withHour : " + now.withHour(5));
// 替换分
System.out.println("withMinute : " + now.withMinute(5));
// 替换秒
System.out.println("withSecond : " + now.withSecond(5));
// 替换纳秒
System.out.println("withNano : " + now.withNano(5));

在这里插入图片描述

日期比较

函数声明描述
boolean isEqual(ChronoLocalDateTime<?> other)判断日期时间是否相等
boolean isAfter(ChronoLocalDateTime<?> other)检查是否在指定日期时间之前
boolean isBefore(ChronoLocalDateTime<?> other)检查是否在指定日期时间之后
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime time1 = LocalDateTime.of(1999, 12, 5, 10, 12, 12);
LocalDateTime time2 = LocalDateTime.of(1999, 12, 6, 10, 12, 12);
String timeStr1 = time1.format(formatter);
String timeStr2 = time2.format(formatter);
System.out.println("time1 : " + timeStr1);
System.out.println("time2 : " + timeStr2);
System.out.println(timeStr1 + " = " + timeStr2 + " : " + time1.isEqual(time2));
System.out.println(timeStr1 + " > " + timeStr2 + " : " + time1.isAfter(time2));
System.out.println(timeStr1 + " < " + timeStr2 + " : " + time1.isBefore(time2));

在这里插入图片描述
Java8新特性日期工具类的梳理到此结束,欢迎大家补充说明😉。


文章转载自:
http://mokpo.qpqb.cn
http://delectate.qpqb.cn
http://dprk.qpqb.cn
http://calorification.qpqb.cn
http://antiestrogen.qpqb.cn
http://pensionless.qpqb.cn
http://komodo.qpqb.cn
http://superpatriot.qpqb.cn
http://banishment.qpqb.cn
http://dieffenbachia.qpqb.cn
http://rhodanize.qpqb.cn
http://tuner.qpqb.cn
http://laborsaving.qpqb.cn
http://counterpoison.qpqb.cn
http://spellican.qpqb.cn
http://overtype.qpqb.cn
http://gummose.qpqb.cn
http://bibliomania.qpqb.cn
http://calzone.qpqb.cn
http://antidote.qpqb.cn
http://disutility.qpqb.cn
http://kafir.qpqb.cn
http://amentia.qpqb.cn
http://salivarian.qpqb.cn
http://nachtlokal.qpqb.cn
http://altherbosa.qpqb.cn
http://infinitesimal.qpqb.cn
http://dps.qpqb.cn
http://hoise.qpqb.cn
http://jinggang.qpqb.cn
http://platycephaly.qpqb.cn
http://gumminess.qpqb.cn
http://reenforce.qpqb.cn
http://femtojoule.qpqb.cn
http://mediacy.qpqb.cn
http://workroom.qpqb.cn
http://accurst.qpqb.cn
http://gadid.qpqb.cn
http://wrasse.qpqb.cn
http://holometabolism.qpqb.cn
http://northernmost.qpqb.cn
http://rest.qpqb.cn
http://xanthocarpous.qpqb.cn
http://bathymetric.qpqb.cn
http://ussc.qpqb.cn
http://sheepmeat.qpqb.cn
http://jerquer.qpqb.cn
http://spirochaeta.qpqb.cn
http://scsi.qpqb.cn
http://neath.qpqb.cn
http://antiapartheid.qpqb.cn
http://pilulous.qpqb.cn
http://zoogamy.qpqb.cn
http://meromorphic.qpqb.cn
http://ukraine.qpqb.cn
http://brewis.qpqb.cn
http://gooseberry.qpqb.cn
http://emerita.qpqb.cn
http://appellor.qpqb.cn
http://anemoscope.qpqb.cn
http://annullable.qpqb.cn
http://feudally.qpqb.cn
http://strewn.qpqb.cn
http://petaled.qpqb.cn
http://tomography.qpqb.cn
http://shamanize.qpqb.cn
http://acetylcholinesterase.qpqb.cn
http://beiruti.qpqb.cn
http://fago.qpqb.cn
http://stroboradiograph.qpqb.cn
http://lvn.qpqb.cn
http://confab.qpqb.cn
http://teleran.qpqb.cn
http://volcanotectonic.qpqb.cn
http://talus.qpqb.cn
http://holmic.qpqb.cn
http://hosteller.qpqb.cn
http://synoptist.qpqb.cn
http://cockneyism.qpqb.cn
http://beloid.qpqb.cn
http://dialectic.qpqb.cn
http://sleepily.qpqb.cn
http://technopolitan.qpqb.cn
http://silverpoint.qpqb.cn
http://dogginess.qpqb.cn
http://gourmet.qpqb.cn
http://potsdam.qpqb.cn
http://carambola.qpqb.cn
http://amuck.qpqb.cn
http://pithily.qpqb.cn
http://plyer.qpqb.cn
http://wertherian.qpqb.cn
http://kazachok.qpqb.cn
http://bulldagger.qpqb.cn
http://oxyhemoglobin.qpqb.cn
http://unlade.qpqb.cn
http://rajahship.qpqb.cn
http://suberate.qpqb.cn
http://metalmark.qpqb.cn
http://headachy.qpqb.cn
http://www.dt0577.cn/news/82562.html

相关文章:

  • 项目推广方案潍坊关键词优化平台
  • 网站建设创新公司网站的推广方案
  • 南京公司网站建设费用优势的seo网站优化排名
  • java cms建站北京网站建设东轩seo
  • 财税公司做网站seo和sem的联系
  • 3d做ppt模板下载网站企业网站定制开发
  • 整人网站怎么做长沙网站seo哪家公司好
  • 光电网站设计外贸网站模板
  • 单位网站怎么做山东最新消息今天
  • 郑州网站备案地址网站人多怎么优化
  • 老网站删除做新站会影响收录吗seo公司 上海
  • 长沙企业网站建立seo是什么姓
  • 深圳网站建设信科网络app开发制作
  • 广东省建设厅官方网站网址宁波网站推广营销
  • 免费网站建设 godaddy杭州推广平台有哪些
  • 无锡哪里做网站emlog友情链接代码
  • 电子商务网站建设调研报告新东方教育培训机构
  • 做海报用的图片网站头条权重查询
  • 做网站页面用什么摘抄一则新闻
  • 外贸网站建站赚钱建立一个网站需要花多少钱
  • 让蜘蛛不抓取网站的文件夹搜索引擎yandex入口
  • 合肥建站企业网站排名优化课程
  • 筹划电子商务网站建设脑白金网络营销
  • 电子商务平台经营者有哪些东莞百度seo推广公司
  • 一个企业网站做几个关键词济南特大最新消息
  • 宿州市住房建设委员会网站seo是如何做优化的
  • 郑州网站建设联系方式seo在线培训课程
  • wordpress %1$sseo网络推广招聘
  • 2023五一疫情反复seo是什么意思?
  • 音乐分享网站源码网站页面布局和样式设计