java.time.LocalDateTime

Modifier and TypeMethodDescription
static LocalDateTimenow()返回当前系统的日期和时间

Modifier and TypeMethodDescription
static LocalDateTimeof(int year, int month, int dayOfMonth, int hour, int minute)按照给定的参数设置日期和时间,秒、毫秒默认设置为0
static LocalDateTimeof(int year, int month, int dayOfMonth, int hour, int minute, int second)按照给定的参数设置日期和时间,毫秒默认设置为0
static LocalDateTimeof(int year, int month, int dayOfMonth, int hour, int minute, int second, int nanoOfSecond)按照给定的参数设置日期和时间
static LocalDateTimeof(LocalDate date, LocalTime time)按照给定的参数设置日期和时间

Modifier and TypeMethodDescription
static LocalDateTimeparse(CharSequence text, DateTimeFormatter formatter)用指定格式的字符串构造一个日期和时间对象

Modifier and TypeMethodDescription
LocalDatetoLocalDate()返回当前日期和时间对象的日期部分
LocalTimetoLocalTime()返回当前日期和时间对象的时间部分

Modifier and TypeMethodDescription
intgetNano()获取当前日期和时间对象的毫秒数
intgetSecond()获取当前日期和时间对象的秒数
intgetMinute()获取当前日期和时间对象的分钟数
intgetHour()获取当前日期和时间对象的小时数
intgetDayOfMonth()返回当前日期和时间对象是一个月中的第几天
intgetDayOfYear()返回当前日期和时间对象是一年中的第几天
intgetMonthValue()获取当前日期和时间对象的月份数
intgetYear()获取当前日期和时间对象的年份数

Modifier and TypeMethodDescription
Stringformat(DateTimeFormatter formatter)按照指定格式返回当前日期和时间对象对应的字符串

Modifier and TypeMethodDescription
LocalDateTimeplusNanos(long nanos)将当前日期和时间对象增加指定的毫秒数
LocalDateTimeplusSeconds(long seconds)将当前日期和时间对象增加指定的秒数
LocalDateTimeplusMinutes(long minutes)将当前日期和时间对象增加指定的分钟数
LocalDateTimeplusHours(long hours)将当前日期和时间对象增加指定的小时数
LocalDateTimeplusDays(long days)将当前日期和时间对象增加指定的天数
LocalDateTimeplusWeeks(long weeks)将当前日期和时间对象增加指定的星期数
LocalDateTimeplusMonths(long months)将当前日期和时间对象增加指定的月份数
LocalDateTimeplusYears(long years)将当前日期和时间对象增加指定的年份数

Modifier and TypeMethodDescription
LocalDateTimeminusNanos(long nanos)将当前日期和时间对象减少指定的毫秒数
LocalDateTimeminusSeconds(long seconds)将当前日期和时间对象减少指定的秒数
LocalDateTimeminusMinutes(long minutes)将当前日期和时间对象减少指定的分钟数
LocalDateTimeminusHours(long hours)将当前日期和时间对象减少指定的小时数
LocalDateTimeminusDays(long days)将当前日期和时间对象减少指定的天数
LocalDateTimeminusWeeks(long weeks)将当前日期和时间对象减少指定的星期数
LocalDateTimeminusMonths(long months)将当前日期和时间对象减少指定的月份数
LocalDateTimeminusYears(long years)将当前日期和时间对象减少指定的年份数

Modifier and TypeMethodDescription
LocalDateTimewithNano(int nanoOfSecond)将当前日期和时间对象的毫秒调整为指定值
LocalDateTimewithSecond(int second)将当前日期和时间对象的秒调整为指定值
LocalDateTimewithMinute(int minute)将当前日期和时间对象的分钟调整为指定值
LocalDateTimewithHour(int hour)将当前日期和时间对象的小时调整为指定值
LocalDateTimewithDayOfMonth(int dayOfMonth)修改一个月中的第几天为指定值
LocalDateTimewithDayOfYear(int dayOfYear)修改一年中的第几天为指定值
LocalDateTimewithMonth(int month)将当前日期和时间对象的月份调整为指定值
LocalDateTimewithYear(int year)将当前日期和时间对象的年份调整为指定值

Modifier and TypeMethodDescription
booleanisAfter(ChronoLocalDateTime<?> other)判断当前日期和时间对象是否在给定日期和时间对象之后。如果是则返回true
booleanisBefore(ChronoLocalDateTime<?> other)判断当前日期和时间对象是否在给定日期和时间对象之前。如果是则返回true
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值