编程语言
首页 > 编程语言> > JAVA中DateTime的用法总结

JAVA中DateTime的用法总结

作者:互联网

原文链接:这里

一、
名称 作用 详细示例
DateTime.now 获取当前时间 示例
DateTime.getMillis() 获取时间戳 示例
DateTime.getCenturyOfEra() 获取世纪单位 示例
DateTime.getDayOfMonth() 月的第几天 示例
DateTime.getDayOfYear() 年的第几天 示例
DateTime.getEra() 这个日期的时代 示例
DateTime.getHourOfDay() 今天的第几个小时 示例
DateTime.getMillisOfDay() 天的时间戳 示例
DateTime.getMillisOfSecond() 分钟的时间戳 示例
DateTime.getMinuteOfDay() 天的第多少分钟 示例
DateTime.getMinuteOfHour() 小时的第多少分钟 示例
DateTime.getMonthOfYear() 年的第多少月 示例
DateTime.getSecondOfDay() 天的多少秒 示例
DateTime.getSecondOfMinute() 分钟的多少秒 示例
DateTime.getWeekOfWeekyear() 年的第几个周 示例
DateTime.getWeekyear() 星期年 示例
DateTime.getYear() 示例
DateTime.getYearOfCentury() 年的世纪 示例
DateTime.getYearOfEra() 当前时代的年份 示例

二、
名称 作用 示例
minusDays() 减多少天  
minusHours() 减多少小时  
minusMillis() 减多少毫秒  
minusMinutes() 减多少分钟  
minusMonths() 减多少月  
minusSeconds() 减多少秒  
minusWeeks() 减多少周  
minusYears() 减多少年  

三、

名称 作用 示例
plusDays() 加多少天  
plusHours() 加多少小时  
plusMillis() 加多少毫秒  
plusMinutes() 加多少分钟  
plusMonths() 加多少月  
plusSeconds() 加多少秒  
plusWeeks() 加多少周  
plusYears() 加多少年  

标签:JAVA,第几个,示例,用法,分钟,DateTime,加多少,多少
来源: https://www.cnblogs.com/longkui-site/p/15859319.html