本文整理了Java中java.time.ZonedDateTime.getMonthValue()
方法的一些代码示例,展示了ZonedDateTime.getMonthValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonedDateTime.getMonthValue()
方法的具体详情如下:
包路径:java.time.ZonedDateTime
类名称:ZonedDateTime
方法名:getMonthValue
[英]Gets the month-of-year field from 1 to 12.
This method returns the month as an int from 1 to 12. Application code is frequently clearer if the enum Monthis used by calling #getMonth().
[中]获取从1到12的月份字段。
此方法将月份返回为1到12之间的整数。如果通过调用#getMonth()来使用enum Monthis,则应用程序代码通常更清晰。
代码示例来源:origin: blynkkk/blynk-server
private ZonedDateTime adjustToStartDate(ZonedDateTime zonedStartAt, ZonedDateTime zonedNow, ZoneId zoneId) {
if (durationType == ReportDurationType.CUSTOM) {
ZonedDateTime zonedStartDate = getZonedFromTs(startTs, zoneId).with(LocalTime.MIN);
if (zonedStartDate.isAfter(zonedNow)) {
zonedStartAt = zonedStartAt
.withDayOfMonth(zonedStartDate.getDayOfMonth())
.withMonth(zonedStartDate.getMonthValue())
.withYear(zonedStartDate.getYear());
}
}
return zonedStartAt;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
public int getMonthValue() {
return dt.getMonthValue();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Deprecated
public int getMonthOfYear() {
logDeprecatedMethod("getMonthOfYear()", "getMonthValue()");
return dt.getMonthValue();
}
代码示例来源:origin: HubSpot/jinjava
@SuppressWarnings("deprecation")
@Override
public int getMonth() {
return date.getMonthValue();
}
代码示例来源:origin: mulesoft/mule
private void assertTimeZoneDate(ZonedDateTime openingDate) {
assertEquals(openingDate.getYear(), YEAR);
assertEquals(openingDate.getMonthValue(), MONTH);
assertEquals(openingDate.getDayOfMonth(), DAY);
}
代码示例来源:origin: apache/tinkerpop
@Override
public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final ZonedDateTime zonedDateTime) {
output.writeInt(zonedDateTime.getYear());
output.writeInt(zonedDateTime.getMonthValue());
output.writeInt(zonedDateTime.getDayOfMonth());
output.writeInt(zonedDateTime.getHour());
output.writeInt(zonedDateTime.getMinute());
output.writeInt(zonedDateTime.getSecond());
output.writeInt(zonedDateTime.getNano());
output.writeString(zonedDateTime.getZone().getId());
}
代码示例来源:origin: co.cask.wrangler/wrangler-core
/**
* Converts a {@link ZonedDateTime} to Month in year.
* <p>
* January is 1, February is 2, and so on.
* </p>
* @param date to extract month.
* @return month.
*/
public static int MONTH(ZonedDateTime date) {
validate(date, "MONTH");
return date.getMonthValue();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Deprecated
public int getMonthOfYear() {
logDeprecatedMethod("getMonthOfYear()", "getMonthValue()");
return dt.getMonthValue();
}
代码示例来源:origin: stackoverflow.com
ZoneId zoneId = ZoneId.of( "Europe/Paris" );
ZonedDateTime now = ZonedDateTime.now( zoneId );
int dayOfMonth = now.getDayOfMonth();
int monthOfYear = now.getMonthValue(); // 1-based counting, January = 1, unlike java.util.Calendar.
String nowAsString = DateTimeFormatter.ofLocalizedDate( FormatStyle.FULL ).withLocale( Locale.FRANCE ).format( now );
代码示例来源:origin: apache/servicemix-bundles
@Deprecated
public int getMonthOfYear() {
logDeprecatedMethod("getMonthOfYear()", "getMonthValue()");
return dt.getMonthValue();
}
代码示例来源:origin: com.cronutils/cron-utils
private TimeNode generateDayCandidatesUsingDoM(final ZonedDateTime reference) {
final LocalDate date = LocalDate.of(reference.getYear(), reference.getMonthValue(), 1);
final int lengthOfMonth = date.lengthOfMonth();
final List<Integer> candidates = createDayOfMonthValueGeneratorInstance(daysOfMonthCronField, reference.getYear(), reference.getMonthValue())
.generateCandidates(1, lengthOfMonth)
.stream().distinct().sorted()
.collect(Collectors.toList());
return new TimeNode(candidates);
}
代码示例来源:origin: stackoverflow.com
@Test
public void renamingToArbitraryMethodName() throws Exception {
ZonedDateTime current = ZonedDateTime.now();
ZonedDateTime mockMidNight = ZonedDateTime.of(current.getYear(), current.getMonthValue(),
current.getDayOfMonth(), 0, 0, 0, 0, ZoneId.of("US/Eastern"));
PowerMockito.mockStatic(ZonedDateTime.class);
PowerMockito.when(ZonedDateTime.ofInstant(anyObject(), anyObject())).thenReturn(mockTime);
}
代码示例来源:origin: org.ballerinalang/siddhi-core
private static long getStartTimeOfAggregatesForMonth(long currentTime, String timeZone) {
ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(Instant.ofEpochMilli(currentTime),
ZoneId.ofOffset("GMT", ZoneOffset.of(timeZone)));
return ZonedDateTime.of(zonedDateTime.getYear(), zonedDateTime.getMonthValue(), 1, 0, 0, 0, 0,
ZoneId.ofOffset("GMT", ZoneOffset.of(timeZone))).toEpochSecond() * 1000;
}
代码示例来源:origin: no.api.meteo/meteo-core
DayIndexKey(ZonedDateTime dateTime) {
this.dateTime = MeteoDateUtils.toZeroHMSN(dateTime);
this.day = dateTime.getDayOfMonth();
this.month = dateTime.getMonthValue();
this.year = dateTime.getYear();
}
}
代码示例来源:origin: no.api.meteo/meteo-core
private boolean isDateMatch(ZonedDateTime requestedDate, ZonedDateTime actualDate) {
return requestedDate.getYear() == actualDate.getYear() &&
requestedDate.getMonthValue() == actualDate.getMonthValue()
&& requestedDate.getDayOfMonth() == actualDate.getDayOfMonth() &&
requestedDate.getHour() == actualDate.getHour();
}
代码示例来源:origin: org.tiogasolutions.dev/tioga-dev-common
public ZonedDateTime toFirstDate(ZonedDateTime date) {
return (date == null) ? null : ZonedDateTime.of(date.getYear(), date.getMonthValue(), 1,
date.getHour(), date.getMinute(), date.getSecond(), date.getNano(), date.getZone());
}
}
代码示例来源:origin: org.tiogasolutions.dev/tioga-dev-common
public ZonedDateTime toLastDate(ZonedDateTime date) {
YearMonth yearMonth = toYearMonth(date);
int lastDayOfMonth = yearMonth.lengthOfMonth();
return (date == null) ? null : ZonedDateTime.of(date.getYear(), date.getMonthValue(), lastDayOfMonth,
date.getHour(), date.getMinute(), date.getSecond(), date.getNano(), date.getZone());
}
代码示例来源:origin: dlemmermann/CalendarFX
static DateValue zonedDateTimeToDateValue(ZonedDateTime dt) {
return new DateTimeValueImpl(
dt.getYear(), dt.getMonthValue(), dt.getDayOfMonth(),
dt.getHour(), dt.getMinute(), dt.getSecond());
}
代码示例来源:origin: org.mule.runtime/mule-module-extensions-spring-support
private void assertTimeZoneDate(ZonedDateTime openingDate) {
assertEquals(openingDate.getYear(), YEAR);
assertEquals(openingDate.getMonthValue(), MONTH);
assertEquals(openingDate.getDayOfMonth(), DAY);
}
代码示例来源:origin: org.apache.tinkerpop/gremlin-core
@Override
public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final ZonedDateTime zonedDateTime) {
output.writeInt(zonedDateTime.getYear());
output.writeInt(zonedDateTime.getMonthValue());
output.writeInt(zonedDateTime.getDayOfMonth());
output.writeInt(zonedDateTime.getHour());
output.writeInt(zonedDateTime.getMinute());
output.writeInt(zonedDateTime.getSecond());
output.writeInt(zonedDateTime.getNano());
output.writeString(zonedDateTime.getZone().getId());
}
内容来源于网络,如有侵权,请联系作者删除!