java dayofweek_Java日期时间API系列22-----Jdk8中java.time包中的新的日期时间API类,Month月份和DayOfWeek星期的计算。...

/*** 获取月, 比如 1

*@paramdate

*@return

*/

public static intgetMonth(Date date){returnDateTimeConverterUtil.toLocalDateTime(date).getMonthValue();

}/*** 获取月, 比如 1

*@paraminstant

*@return

*/

public static intgetMonth(Instant instant){returnDateTimeConverterUtil.toLocalDateTime(instant).getMonthValue();

}/*** 获取月, 比如 1

* LocalDateTime LocalDate ZonedDateTime 可以直接getMonthValue()

*@paramlocalDateTime

*@return

*/

public static intgetMonth(LocalDateTime localDateTime){

Objects.requireNonNull(localDateTime,"localDateTime");returnlocalDateTime.getMonthValue();

}/*** 获取月英文全称, 比如 January

* January, February, March, April, May, June, July, August, September, October,

* November and December

*@paramdate

*@return

*/

public staticString getMonthEnLong(Date date){returnMonthNameEnum.getFullNameEnByCode(getMonth(date));

}/*** 获取月英文全称, 比如 January

* January, February, March, April, May, June, July, August, September, October,

* November and December

*@paraminstant

*@return

*/

public staticString getMonthEnLong(Instant instant){returnMonthNameEnum.getFullNameEnByCode(getMonth(instant));

}/*** 获取月英文全称, 比如 January

* January, February, March, April, May, June, July, August, September, October,

* November and December

* LocalDateTime LocalDate ZonedDateTime 可以直接.getMonth().toString()

*@paramlocalDateTime

*@return

*/

public staticString getMonthEnLong(LocalDateTime localDateTime){

Objects.requireNonNull(localDateTime,"localDateTime");returnMonthNameEnum.getFullNameEnByCode(getMonth(localDateTime));

}/*** 获取月英文简称, 比如 Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec

*@paramdate

*@return

*/

public staticString getMonthEnShort(Date date){returnMonthNameEnum.getShortNameEnByCode(getMonth(date));

}/*** 获取月英文简称, 比如 Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec

*@paraminstant

*@return

*/

public staticString getMonthEnShort(Instant instant){returnMonthNameEnum.getShortNameEnByCode(getMonth(instant));

}/*** 获取月英文简称, 比如 Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec

*@paramlocalDateTime

*@return

*/

public staticString getMonthEnShort(LocalDateTime localDateTime){

Objects.requireNonNull(localDateTime,"localDateTime");returnMonthNameEnum.getShortNameEnByCode(getMonth(localDateTime));

}/*** 获取月份中文全称, 比如一月

*@paramdate

*@return

*/

public staticString getMonthCnLong(Date date){returnMonthNameEnum.getFullNameCnByCode(getMonth(date));

}/*** 获取月份中文全称, 比如一月

*@paraminstant

*@return

*/

public staticString getMonthCnLong(Instant instant){returnMonthNameEnum.getFullNameCnByCode(getMonth(instant));

}/*** 获取月份中文全称, 比如一月

*@paramlocalDateTime

*@return

*/

public staticString getMonthCnLong(LocalDateTime localDateTime){

Objects.requireNonNull(localDateTime,"localDateTime");returnMonthNameEnum.getFullNameCnByCode(getMonth(localDateTime));

}/*** 获取月份中文全称, 比如一

*@paramdate

*@return

*/

public staticString getMonthCnShort(Date date){returnMonthNameEnum.getShortNameCnByCode(getMonth(date));

}/*** 获取月份中文全称, 比如一

*@paraminstant

*@return

*/

public staticString getMonthCnShort(Instant instant){returnMonthNameEnum.getShortNameCnByCode(getMonth(instant));

}/*** 获取月份中文全称, 比如一

*@paramlocalDateTime

*@return

*/

public staticString getMonthCnShort(LocalDateTime localDateTime){

Objects.requireNonNull(localDateTime,"localDateTime");returnMonthNameEnum.getShortNameCnByCode(getMonth(localDateTime));

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值