本文整理了Java中java.time.OffsetDateTime.getDayOfMonth()
方法的一些代码示例,展示了OffsetDateTime.getDayOfMonth()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OffsetDateTime.getDayOfMonth()
方法的具体详情如下:
包路径:java.time.OffsetDateTime
类名称:OffsetDateTime
方法名:getDayOfMonth
[英]Gets the day-of-month field.
This method returns the primitive int value for the day-of-month.
[中]获取月日字段。
此方法返回月日的原始int值。
代码示例来源:origin: org.assertj/assertj-core
/**
* Returns true if both OffsetDateTime are in the same year, month and day of month, false otherwise.
*
* @param actual the actual OffsetDateTime. expected not be null
* @param other the other OffsetDateTime. expected not be null
* @return true if both OffsetDateTime are in the same year, month and day of month, false otherwise
*/
private static boolean haveSameYearMonthAndDayOfMonth(OffsetDateTime actual, OffsetDateTime other) {
return haveSameYearAndMonth(actual, other) && actual.getDayOfMonth() == other.getDayOfMonth();
}
代码示例来源:origin: joel-costigliola/assertj-core
/**
* Returns true if both OffsetDateTime are in the same year, month and day of month, false otherwise.
*
* @param actual the actual OffsetDateTime. expected not be null
* @param other the other OffsetDateTime. expected not be null
* @return true if both OffsetDateTime are in the same year, month and day of month, false otherwise
*/
private static boolean haveSameYearMonthAndDayOfMonth(OffsetDateTime actual, OffsetDateTime other) {
return haveSameYearAndMonth(actual, other) && actual.getDayOfMonth() == other.getDayOfMonth();
}
代码示例来源:origin: google/data-transfer-project
@Test
public void testTransform() {
Map<String, String> map = new HashMap<>();
map.put("dateTime", "2018-02-14T18:00:00.0000000");
map.put("timeZone", "UTC");
CalendarEventModel.CalendarEventTime time =
transformer.apply(map, new TestTransformerContext());
Assert.assertEquals(18, time.getDateTime().getHour());
Assert.assertEquals(2018, time.getDateTime().getYear());
Assert.assertEquals(14, time.getDateTime().getDayOfMonth());
}
}
代码示例来源:origin: debezium/debezium
assertThat(c4DateTime.getYear()).isEqualTo(1970);
assertThat(c4DateTime.getMonth()).isEqualTo(Month.JANUARY);
assertThat(c4DateTime.getDayOfMonth()).isEqualTo(1);
代码示例来源:origin: lukstei/trading-backtest
private static String toYahooQueryDate(Instant instant, String names) {
OffsetDateTime time = instant.atOffset(ZoneOffset.UTC);
String[] strings = names.split("");
return format("%s=%d&%s=%d&%s=%d", strings[0], time.getMonthValue() - 1, strings[1], time.getDayOfMonth(), strings[2], time.getYear());
}
}
代码示例来源:origin: kiegroup/optaweb-employee-rostering
public static LocalDate toLocalDate(OffsetDateTime time) {
return LocalDate.of(time.getYear(), time.getMonthValue(), time.getDayOfMonth());
}
代码示例来源:origin: Netflix/iceberg
static String humanDay(int dayOrdinal) {
OffsetDateTime day = EPOCH.plusDays(dayOrdinal);
return String.format("%04d-%02d-%02d",
day.getYear(), day.getMonth().getValue(), day.getDayOfMonth());
}
代码示例来源:origin: Netflix/iceberg
@Override
public String read(String reuse) {
OffsetDateTime day = EPOCH.plusDays(column.nextInteger());
return format("%04d-%02d-%02d", day.getYear(), day.getMonth().getValue(), day.getDayOfMonth());
}
}
代码示例来源:origin: Netflix/iceberg
static String humanHour(int hourOrdinal) {
OffsetDateTime time = EPOCH.plusHours(hourOrdinal);
return String.format("%04d-%02d-%02d-%02d",
time.getYear(), time.getMonth().getValue(), time.getDayOfMonth(), time.getHour());
}
代码示例来源:origin: avaire/avaire
/**
* Creates a new Carbon instance from the provided offset date time object.
*
* @param offsetDateTime The offset date time that the Carbon instance should be created from.
* @return a Carbon instance with the provided date and time.
*/
public static Carbon createFromOffsetDateTime(OffsetDateTime offsetDateTime) {
return Carbon.create(
offsetDateTime.getYear(),
offsetDateTime.getMonthValue(),
offsetDateTime.getDayOfMonth(),
offsetDateTime.getHour(),
offsetDateTime.getMinute(),
offsetDateTime.getSecond()
);
}
代码示例来源:origin: rocks.xmpp/xmpp-extensions-common
/**
* Creates a date value.
*
* @param date The date value.
*/
private Value(OffsetDateTime date) {
XMLGregorianCalendar xmlGregorianCalendar;
try {
xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
xmlGregorianCalendar.setYear(date.getYear());
xmlGregorianCalendar.setMonth(date.getMonth().getValue());
xmlGregorianCalendar.setDay(date.getDayOfMonth());
xmlGregorianCalendar.setTime(date.getHour(), date.getMinute(), date.getSecond()); // date.get(ChronoField.MILLI_OF_SECOND)
xmlGregorianCalendar.setTimezone(date.getOffset().getTotalSeconds() / 60);
} catch (DatatypeConfigurationException e) {
xmlGregorianCalendar = null;
}
this.value = xmlGregorianCalendar;
}
代码示例来源:origin: hprose/hprose-java
@Override
public final void serialize(Writer writer, OffsetDateTime datetime) throws IOException {
super.serialize(writer, datetime);
OutputStream stream = writer.stream;
if (!(datetime.getOffset().equals(ZoneOffset.UTC))) {
stream.write(TagString);
ValueWriter.write(stream, datetime.toString());
}
else {
int year = datetime.getYear();
if (year > 9999 || year < 1) {
stream.write(TagString);
ValueWriter.write(stream, datetime.toString());
}
else {
ValueWriter.writeDate(stream, year, datetime.getMonthValue(), datetime.getDayOfMonth());
ValueWriter.writeTime(stream, datetime.getHour(), datetime.getMinute(), datetime.getSecond(), 0, false, true);
ValueWriter.writeNano(stream, datetime.getNano());
stream.write(TagUTC);
}
}
}
}
代码示例来源:origin: org.hprose/hprose-java
@Override
public final void serialize(Writer writer, OffsetDateTime datetime) throws IOException {
super.serialize(writer, datetime);
OutputStream stream = writer.stream;
if (!(datetime.getOffset().equals(ZoneOffset.UTC))) {
stream.write(TagString);
ValueWriter.write(stream, datetime.toString());
}
else {
int year = datetime.getYear();
if (year > 9999 || year < 1) {
stream.write(TagString);
ValueWriter.write(stream, datetime.toString());
}
else {
ValueWriter.writeDate(stream, year, datetime.getMonthValue(), datetime.getDayOfMonth());
ValueWriter.writeTime(stream, datetime.getHour(), datetime.getMinute(), datetime.getSecond(), 0, false, true);
ValueWriter.writeNano(stream, datetime.getNano());
stream.write(TagUTC);
}
}
}
}
代码示例来源:origin: ngs-doo/dsl-json
NumberConverter.write2(value.getMonthValue(), buf, pos + 6);
buf[pos + 8] = '-';
NumberConverter.write2(value.getDayOfMonth(), buf, pos + 9);
buf[pos + 11] = 'T';
NumberConverter.write2(value.getHour(), buf, pos + 12);
代码示例来源:origin: io.debezium/debezium-connector-mysql
assertThat(c4DateTime.getYear()).isEqualTo(1970);
assertThat(c4DateTime.getMonth()).isEqualTo(Month.JANUARY);
assertThat(c4DateTime.getDayOfMonth()).isEqualTo(1);
内容来源于网络,如有侵权,请联系作者删除!