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

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

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

LocalDateTime.hourOfDay介绍

[英]Get the hour of day field property which provides access to advanced functionality.
[中]获取“小时”字段属性,该属性提供对高级功能的访问。

代码示例

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

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

@Override
  public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider provider)
    throws IOException
  {
    switch (_serializationShape(provider)) {
    case FORMAT_STRING:
      gen.writeString(_format.createFormatter(provider).print(value));
      break;
    case FORMAT_TIMESTAMP:
      {
        // copied from `LocalDateTimeDeserializer`...
        DateTimeZone tz = _format.isTimezoneExplicit() ? _format.getTimeZone()
            : DateTimeZone.forTimeZone(provider.getTimeZone());
        gen.writeNumber(value.toDateTime(tz).getMillis());
      }
      break;
    case FORMAT_ARRAY:
      // Timestamp here actually means an array of values
      gen.writeStartArray();
      gen.writeNumber(value.year().get());
      gen.writeNumber(value.monthOfYear().get());
      gen.writeNumber(value.dayOfMonth().get());
      gen.writeNumber(value.hourOfDay().get());
      gen.writeNumber(value.minuteOfHour().get());
      gen.writeNumber(value.secondOfMinute().get());
      gen.writeNumber(value.millisOfSecond().get());
      gen.writeEndArray();
    }
  }
}

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

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

@Override
public void serialize(LocalDateTime 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.writeNumber(dt.hourOfDay().get());
    jgen.writeNumber(dt.minuteOfHour().get());
    jgen.writeNumber(dt.secondOfMinute().get());
    jgen.writeNumber(dt.millisOfSecond().get());
    jgen.writeEndArray();
  } else {
    jgen.writeString(printLocalDateTime(dt));
  }
}

代码示例来源:origin: dremio/dremio-oss

return tmpValue.hourOfDay().roundFloorCopy();
} else {
 return tmpValue.hourOfDay().roundCeilingCopy();

相关文章