mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add method
This commit is contained in:
parent
f12de13813
commit
b7663ff7e7
@ -44,6 +44,11 @@ public class DateTime extends Date {
|
|||||||
*/
|
*/
|
||||||
private TimeZone timeZone;
|
private TimeZone timeZone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第一周最少天数
|
||||||
|
*/
|
||||||
|
private int minimalDaysInFirstWeek;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 转换时间戳为 DateTime
|
* 转换时间戳为 DateTime
|
||||||
*
|
*
|
||||||
@ -670,6 +675,10 @@ public class DateTime extends Date {
|
|||||||
final Calendar cal = (null != zone) ? Calendar.getInstance(zone, locale) : Calendar.getInstance(locale);
|
final Calendar cal = (null != zone) ? Calendar.getInstance(zone, locale) : Calendar.getInstance(locale);
|
||||||
//noinspection MagicConstant
|
//noinspection MagicConstant
|
||||||
cal.setFirstDayOfWeek(firstDayOfWeek.getValue());
|
cal.setFirstDayOfWeek(firstDayOfWeek.getValue());
|
||||||
|
// issue#1988@Github
|
||||||
|
if (minimalDaysInFirstWeek > 0) {
|
||||||
|
cal.setMinimalDaysInFirstWeek(minimalDaysInFirstWeek);
|
||||||
|
}
|
||||||
cal.setTime(this);
|
cal.setTime(this);
|
||||||
return cal;
|
return cal;
|
||||||
}
|
}
|
||||||
@ -908,6 +917,18 @@ public class DateTime extends Date {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置第一周最少天数
|
||||||
|
*
|
||||||
|
* @param minimalDaysInFirstWeek 第一周最少天数
|
||||||
|
* @return this
|
||||||
|
* @since 5.7.17
|
||||||
|
*/
|
||||||
|
public DateTime setMinimalDaysInFirstWeek(int minimalDaysInFirstWeek) {
|
||||||
|
this.minimalDaysInFirstWeek = minimalDaysInFirstWeek;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------- toString start
|
// -------------------------------------------------------------------- toString start
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user