org.joda.time.LocalDate.monthOfYear()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中org.joda.time.LocalDate.monthOfYear()方法的一些代码示例,展示了LocalDate.monthOfYear()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.monthOfYear()方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:monthOfYear

LocalDate.monthOfYear介绍

[英]Get the month of year property which provides access to advanced functionality.
[中]获取提供高级功能访问权限的月份属性。

代码示例

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-joda

@Override
  public void serialize(LocalDate value, JsonGenerator gen, SerializerProvider provider) throws IOException
  {
    if (_serializationShape(provider) == FORMAT_STRING) {
      gen.writeString(_format.createFormatter(provider).print(value));
      return;
    }
    // 28-Jul-2017, tatu: Wrt [dataformat-joda#39]... we could perhaps support timestamps,
    //   but only by specifying what to do with time (`LocalTime`) AND timezone. For now,
    //   seems like asking for trouble really... so only use array notation.
    gen.writeStartArray();
    gen.writeNumber(value.year().get());
    gen.writeNumber(value.monthOfYear().get());
    gen.writeNumber(value.dayOfMonth().get());
    gen.writeEndArray();
  }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

代码示例来源:origin: com.thesett.jenerator.utils/jenerator_util

/**
 * Provides the date that is the start of the quarter that the specified date lies within.
 *
 * @param  someDate A date to get the quarter start for.
 *
 * @return The date that is the start of the quarter that the specified date lies within.
 */
public static LocalDate startDateOfQuarter(LocalDate someDate) {
  int month = someDate.monthOfYear().get();
  int quarter = (month - 1) / 3;
  int qStartMonth = (quarter * 3) + 1;
  return new LocalDate(someDate.year().get(), qStartMonth, 1);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

代码示例来源:origin: com.cronutils/htime

@VisibleForTesting
Map<String, String> initMonths(Locale locale) {
  String fullMonth =
      String.format("%s%s%s%s",
          constants.monthOfYear(), constants.monthOfYear(),
          constants.monthOfYear(), constants.monthOfYear()
      );
  String shortMonth = String.format("%s%s%s", constants.monthOfYear(),
      constants.monthOfYear(), constants.monthOfYear());
  LocalDate date = new LocalDate();
  Map<String, String> mapping = Maps.newHashMap();
  for (int j = 1; j < 13; j++) {
    String moy = date.withMonthOfYear(j).monthOfYear().getAsText(locale).toLowerCase();
    mapping.put(moy, fullMonth);
    mapping.put(moy.substring(0, 3), shortMonth);
  }
  return mapping;
}

代码示例来源:origin: daniellitoc/xultimate-toolkit

LOGGER.info("{}", lastDayOfPreviousMonth);
LocalDate electionDate = now.monthOfYear()
     .setCopy(11)        // November

代码示例来源:origin: org.codehaus.jackson/jackson-mapper-lgpl

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

代码示例来源:origin: com.barchart.wrap/barchart-wrap-jackson

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

代码示例来源:origin: ovea-deprecated/jetty-session-redis

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

代码示例来源:origin: com.alibaba.edas.acm/acm-sdk

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

代码示例来源:origin: harbby/presto-connectors

@Override
public void serialize(LocalDate dt, JsonGenerator jgen, SerializerProvider provider)
  throws IOException, JsonGenerationException
{
  if (provider.isEnabled(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS)) {
    // Timestamp here actually means an array of values
    jgen.writeStartArray();
    jgen.writeNumber(dt.year().get());
    jgen.writeNumber(dt.monthOfYear().get());
    jgen.writeNumber(dt.dayOfMonth().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDate(dt));
  }
}

相关文章