gpt4 book ai didi

java.time.ZoneOffset.toString()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 14:32:40 29 4
gpt4 key购买 nike

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

ZoneOffset.toString介绍

[英]Outputs this offset as a String, using the normalized ID.
[中]使用规范化ID将该偏移量作为字符串输出。

代码示例

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

private final void _serializeAsArrayContents(OffsetTime value, JsonGenerator g,
    SerializerProvider provider) throws IOException
{
  g.writeNumber(value.getHour());
  g.writeNumber(value.getMinute());
  final int secs = value.getSecond();
  final int nanos = value.getNano();
  if ((secs > 0) || (nanos > 0)) {
    g.writeNumber(secs);
    if (nanos > 0) {
      if(useNanoseconds(provider)) {
        g.writeNumber(nanos);
      } else {
        g.writeNumber(value.get(ChronoField.MILLI_OF_SECOND));
      }
    }
  }
  g.writeString(value.getOffset().toString());
}

代码示例来源:origin: neo4j/neo4j

private static String currentTimeZoneOffsetString()
  {
    ZoneOffset offset = OffsetDateTime.now().getOffset();
    return offset.equals( UTC ) ? "+0000" : offset.toString().replace( ":", "" );
  }
}

代码示例来源:origin: neo4j/neo4j

return Values.stringValue( getZoneOffset().toString() );

代码示例来源:origin: ebean-orm/ebean

@Override
public String convertToDbString(ZoneOffset beanValue) {
 return beanValue.toString();
}

代码示例来源:origin: ebean-orm/ebean

@Override
public String formatValue(ZoneOffset v) {
 return v.toString();
}

代码示例来源:origin: prestodb/presto

private final void _serializeAsArrayContents(OffsetTime value, JsonGenerator g,
    SerializerProvider provider) throws IOException
{
  g.writeNumber(value.getHour());
  g.writeNumber(value.getMinute());
  final int secs = value.getSecond();
  final int nanos = value.getNano();
  if ((secs > 0) || (nanos > 0)) {
    g.writeNumber(secs);
    if (nanos > 0) {
      if(useNanoseconds(provider)) {
        g.writeNumber(nanos);
      } else {
        g.writeNumber(value.get(ChronoField.MILLI_OF_SECOND));
      }
    }
  }
  g.writeString(value.getOffset().toString());
}

代码示例来源:origin: org.jadira.usertype/usertype.extended

@Override
  public String toNonNullValue(ZoneOffset value) {
    return value.toString();
  }
}

代码示例来源:origin: org.jadira.usertype/usertype.core

@Override
  public String toNonNullValue(ZoneOffset value) {
    return value.toString();
  }
}

代码示例来源:origin: io.ebean/ebean

@Override
public String formatValue(ZoneOffset v) {
 return v.toString();
}

代码示例来源:origin: org.avaje.ebean/ebean

@Override
public String formatValue(ZoneOffset v) {
 return v.toString();
}

代码示例来源:origin: org.avaje.ebean/ebean

@Override
public String convertToDbString(ZoneOffset beanValue) {
 return beanValue.toString();
}

代码示例来源:origin: io.ebean/ebean

@Override
public String convertToDbString(ZoneOffset beanValue) {
 return beanValue.toString();
}

代码示例来源:origin: alblue/com.packtpub.e4

public String getText(Object element) {
  if (element instanceof ZoneId) {
    return ((ZoneId) element).getRules().getOffset(Instant.now()).toString();
  } else {
    return "";
  }
}

代码示例来源:origin: openmhealth/schemas

@Override
  public void serialize(OffsetDateTime instant, JsonGenerator generator, SerializerProvider provider)
      throws IOException {

    StringBuilder builder = new StringBuilder();

    builder.append(instant.toLocalDateTime().toString());

    if (instant.getSecond() == 0 && instant.getNano() == 0) {
      builder.append(":00");
    }

    builder.append(instant.getOffset().toString());

    generator.writeString(builder.toString());
  }
}

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Outputs this date-time as a {@code String}, such as
 * {@code 2007-12-03T10:15:30+01:00[Europe/Paris]}.
 * <p>
 * The format consists of the {@code LocalDateTime} followed by the {@code ZoneOffset}.
 * If the {@code ZoneId} is not the same as the offset, then the ID is output.
 * The output is compatible with ISO-8601 if the offset and ID are the same.
 *
 * @return a string representation of this date-time, not null
 */
@Override  // override for Javadoc
public String toString() {
  String str = dateTime.toString() + offset.toString();
  if (offset != zone) {
    str += '[' + zone.toString() + ']';
  }
  return str;
}

代码示例来源:origin: epam/DLab

/**
 * Enriches existing scheduler job with the following data:
 * - sets current date as 'beginDate' if this parameter wasn't defined;
 * - sets current system time zone offset as 'timeZoneOffset' if this parameter wasn't defined.
 *
 * @param dto current scheduler job
 */
private void enrichSchedulerJobIfNecessary(SchedulerJobDTO dto) {
  if (Objects.isNull(dto.getBeginDate()) || StringUtils.isBlank(dto.getBeginDate().toString())) {
    dto.setBeginDate(LocalDate.now());
  }
  if (Objects.isNull(dto.getTimeZoneOffset()) || StringUtils.isBlank(dto.getTimeZoneOffset().toString())) {
    dto.setTimeZoneOffset(OffsetDateTime.now(ZoneId.systemDefault()).getOffset());
  }
}

代码示例来源:origin: kiegroup/optaweb-employee-rostering

public static String offsetDateTimeToISO(OffsetDateTime offsetDateTime) {
  return toLocalDate(offsetDateTime).toString() + "T" + getGWTTime(toLocalTime(offsetDateTime)) + offsetDateTime.getOffset().toString();
}

代码示例来源:origin: com.github.seratch/java-time-backport

@Override
public String toString() {
  String str = toLocalDateTime().toString() + getOffset().toString();
  if (getOffset() != getZone()) {
    str += '[' + getZone().toString() + ']';
  }
  return str;
}

代码示例来源:origin: com.github.seratch/java-time-backport

/**
 * Outputs this date-time as a {@code String}.
 * <p>
 * The output will include the full zoned date-time and the chronology ID.
 *
 * @return a string representation of this date-time, not null
 */
@Override
public String toString() {
  String str = toLocalDateTime().toString() + getOffset().toString();
  if (getOffset() != getZone()) {
    str += '[' + getZone().toString() + ']';
  }
  return str;
}

代码示例来源:origin: com.facebook.presto/presto-jdbc

private final void _serializeAsArrayContents(OffsetTime value, JsonGenerator g,
    SerializerProvider provider) throws IOException
{
  g.writeNumber(value.getHour());
  g.writeNumber(value.getMinute());
  final int secs = value.getSecond();
  final int nanos = value.getNano();
  if ((secs > 0) || (nanos > 0)) {
    g.writeNumber(secs);
    if (nanos > 0) {
      if(useNanoseconds(provider)) {
        g.writeNumber(nanos);
      } else {
        g.writeNumber(value.get(ChronoField.MILLI_OF_SECOND));
      }
    }
  }
  g.writeString(value.getOffset().toString());
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com