本文整理了Java中org.threeten.bp.LocalDateTime.getMonthValue()
方法的一些代码示例,展示了LocalDateTime.getMonthValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDateTime.getMonthValue()
方法的具体详情如下:
包路径:org.threeten.bp.LocalDateTime
类名称:LocalDateTime
方法名: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()使用枚举月,则应用程序代码通常更清晰。
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the month-of-year field from 1 to 12.
* <p>
* This method returns the month as an {@code int} from 1 to 12.
* Application code is frequently clearer if the enum {@link Month}
* is used by calling {@link #getMonth()}.
*
* @return the month-of-year, from 1 to 12
* @see #getMonth()
*/
public int getMonthValue() {
return dateTime.getMonthValue();
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Gets the month-of-year field from 1 to 12.
* <p>
* This method returns the month as an {@code int} from 1 to 12.
* Application code is frequently clearer if the enum {@link Month}
* is used by calling {@link #getMonth()}.
*
* @return the month-of-year, from 1 to 12
* @see #getMonth()
*/
public int getMonthValue() {
return dateTime.getMonthValue();
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Gets the month-of-year field from 1 to 12.
* <p>
* This method returns the month as an {@code int} from 1 to 12.
* Application code is frequently clearer if the enum {@link Month}
* is used by calling {@link #getMonth()}.
*
* @return the month-of-year, from 1 to 12
* @see #getMonth()
*/
public int getMonthValue() {
return dateTime.getMonthValue();
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Gets the month-of-year field from 1 to 12.
* <p>
* This method returns the month as an {@code int} from 1 to 12.
* Application code is frequently clearer if the enum {@link Month}
* is used by calling {@link #getMonth()}.
*
* @return the month-of-year, from 1 to 12
* @see #getMonth()
*/
public int getMonthValue() {
return dateTime.getMonthValue();
}
代码示例来源:origin: com.github.joschi.jackson/jackson-datatype-threetenbp
@Override
public void serialize(LocalDateTime value, JsonGenerator g, SerializerProvider provider)
throws IOException
{
if (useTimestamp(provider)) {
g.writeStartArray();
g.writeNumber(value.getYear());
g.writeNumber(value.getMonthValue());
g.writeNumber(value.getDayOfMonth());
g.writeNumber(value.getHour());
g.writeNumber(value.getMinute());
if (value.getSecond() > 0 || value.getNano() > 0) {
g.writeNumber(value.getSecond());
if(value.getNano() > 0) {
if (provider.isEnabled(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS))
g.writeNumber(value.getNano());
else
g.writeNumber(value.get(ChronoField.MILLI_OF_SECOND));
}
}
g.writeEndArray();
} else {
DateTimeFormatter dtf = _formatter;
if (dtf == null) {
dtf = _defaultFormatter();
}
g.writeString(value.format(dtf));
}
}
代码示例来源:origin: ThreeTen/threetenbp
/**
* Converts a {@code LocalDateTime} to a {@code java.sql.Timestamp}.
*
* @param dateTime the local date-time, not null
* @return the SQL timestamp, not null
*/
@SuppressWarnings("deprecation")
public static Timestamp toSqlTimestamp(LocalDateTime dateTime) {
return new Timestamp(
dateTime.getYear() - 1900,
dateTime.getMonthValue() - 1,
dateTime.getDayOfMonth(),
dateTime.getHour(),
dateTime.getMinute(),
dateTime.getSecond(),
dateTime.getNano());
}
代码示例来源:origin: org.threeten/threetenbp
/**
* Converts a {@code LocalDateTime} to a {@code java.sql.Timestamp}.
*
* @param dateTime the local date-time, not null
* @return the SQL timestamp, not null
*/
@SuppressWarnings("deprecation")
public static Timestamp toSqlTimestamp(LocalDateTime dateTime) {
return new Timestamp(
dateTime.getYear() - 1900,
dateTime.getMonthValue() - 1,
dateTime.getDayOfMonth(),
dateTime.getHour(),
dateTime.getMinute(),
dateTime.getSecond(),
dateTime.getNano());
}
代码示例来源:origin: ngs-doo/dsl-json
NumberConverter.write4(year, buf, pos + 1);
buf[pos + 5] = '-';
NumberConverter.write2(value.getMonthValue(), buf, pos + 6);
buf[pos + 8] = '-';
NumberConverter.write2(value.getDayOfMonth(), buf, pos + 9);
内容来源于网络,如有侵权,请联系作者删除!