本文整理了Java中java.time.ZoneId.toString()
方法的一些代码示例,展示了ZoneId.toString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneId.toString()
方法的具体详情如下:
包路径:java.time.ZoneId
类名称:ZoneId
方法名:toString
[英]Outputs this zone as a String, using the ID.
[中]使用ID以字符串形式输出此区域。
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public byte[] convert(ZoneId source) {
return fromString(source.toString());
}
}
代码示例来源:origin: OpenHFT/Chronicle-Queue
public static String formatRollTime(final LocalTime time, final ZoneId zoneId) {
return String.format("%s;%s;%s", Type.ROLL_TIME.name(), time.toString(), zoneId.toString());
}
代码示例来源:origin: OpenHFT/Chronicle-Queue
public static QueueOffsetSpec ofRollTime(final LocalTime time, final ZoneId zoneId) {
return new QueueOffsetSpec(Type.ROLL_TIME, new String[]{time.toString(), zoneId.toString()});
}
代码示例来源:origin: neo4j/neo4j
static OffsetTime defaultTime( ZoneId zoneId )
{
return OffsetTime.of( TemporalFields.hour.defaultValue, TemporalFields.minute.defaultValue,
TemporalFields.second.defaultValue, TemporalFields.nanosecond.defaultValue,
assertValidZone( () -> ZoneOffset.of( zoneId.toString() ) ) );
}
代码示例来源:origin: neo4j/neo4j
return Values.stringValue( getZoneId(this::getZoneOffset).toString() );
代码示例来源:origin: ebean-orm/ebean
@Override
public String formatValue(ZoneId v) {
return v.toString();
}
代码示例来源:origin: ebean-orm/ebean
@Override
public String convertToDbString(ZoneId beanValue) {
return beanValue.toString();
}
代码示例来源:origin: apache/hive
final TimestampLocalTZTypeInfo timestampLocalTZTypeInfo =
(TimestampLocalTZTypeInfo) typeInfo;
final String timeZone = timestampLocalTZTypeInfo.getTimeZone().toString();
return Field.nullable(name, new ArrowType.Timestamp(TimeUnit.MILLISECOND, timeZone));
case BINARY:
代码示例来源:origin: spring-projects/spring-data-couchbase
@Override
public String convert(ZoneId source) {
return source.toString();
}
}
代码示例来源:origin: org.jadira.usertype/usertype.core
@Override
public String toNonNullValue(ZoneId value) {
return value.toString();
}
}
代码示例来源:origin: org.jadira.usertype/usertype.extended
@Override
public String toNonNullValue(ZoneId value) {
return value.toString();
}
}
代码示例来源:origin: org.springframework.data/spring-data-couchbase
@Override
public String convert(ZoneId source) {
return source.toString();
}
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
@Test
public void testLoadJdbcParamsWithConfigLocalDateTime() throws Exception {
testCall(db, "CALL apoc.load.jdbc('jdbc:derby:derbyDB','SELECT * FROM PERSON WHERE NAME = ?',['John'])",
(row) -> assertEquals( Util.map("NAME", "John", "HIRE_DATE", hireDate.toLocalDate(), "EFFECTIVE_FROM_DATE",
effectiveFromDate.toLocalDateTime(), "TEST_TIME", time.toLocalTime(), "NULL_DATE", null), row.get("row")));
ZoneId asiaTokio = ZoneId.of("Asia/Tokyo");
testCall(db, "CALL apoc.load.jdbc('jdbc:derby:derbyDB','SELECT * FROM PERSON WHERE NAME = ?',['John'], {config})",
map("config", map("timezone", asiaTokio.toString())),
(row) -> {
assertEquals( Util.map("NAME", "John",
"HIRE_DATE", hireDate.toLocalDate(),
"EFFECTIVE_FROM_DATE", effectiveFromDate.toInstant().atZone(asiaTokio).toOffsetDateTime(),
"TEST_TIME", time.toLocalTime(),
"NULL_DATE", null), row.get("row"));
});
}
代码示例来源:origin: org.springframework.data/spring-data-redis
@Override
public byte[] convert(ZoneId source) {
return fromString(source.toString());
}
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-extras
@Override
public ByteBuffer serialize(java.time.ZoneId value, ProtocolVersion protocolVersion) {
if (value == null) {
return null;
}
return varchar().serialize(value.toString(), protocolVersion);
}
代码示例来源:origin: com.datastax.cassandra/cassandra-driver-extras
@Override
public String format(java.time.ZoneId value) {
if (value == null) {
return "NULL";
}
return varchar().format(value.toString());
}
代码示例来源:origin: org.neo4j/neo4j-values
static OffsetTime defaultTime( ZoneId zoneId )
{
return OffsetTime.of( TemporalFields.hour.defaultValue, TemporalFields.minute.defaultValue,
TemporalFields.second.defaultValue, TemporalFields.nanosecond.defaultValue,
assertValidZone( () -> ZoneOffset.of( zoneId.toString() ) ) );
}
代码示例来源:origin: qubole/presto-udfs
@Description("given timestamp (in varchar) in a timezone convert it to UTC")
@ScalarFunction("to_utc_timestamp")
@SqlType(StandardTypes.TIMESTAMP)
public static long toUtcTimestamp(@SqlType(StandardTypes.VARCHAR) Slice inputTimestamp, @SqlType(StandardTypes.VARCHAR) Slice inputZoneId)
{
Timestamp javaTimestamp = Timestamp.valueOf(inputTimestamp.toStringUtf8());
ZoneId zoneId = ZoneId.of(inputZoneId.toStringUtf8(), ZoneId.SHORT_IDS);
long offsetTimestamp = packDateTimeWithZone(javaTimestamp.getTime(), zoneId.toString());
return javaTimestamp.getTime() - ((timeZoneHourFromTimestampWithTimeZone(offsetTimestamp) * 60 + timeZoneMinuteFromTimestampWithTimeZone(offsetTimestamp)) * 60) * 1000;
}
代码示例来源:origin: qubole/presto-udfs
@Description("given timestamp in UTC and converts to given timezone")
@ScalarFunction("from_utc_timestamp")
@SqlType(StandardTypes.TIMESTAMP)
public static long fromUtcTimestamp(@SqlType(StandardTypes.TIMESTAMP) long timestamp, @SqlType(StandardTypes.VARCHAR) Slice inputZoneId)
{
ZoneId zoneId = ZoneId.of(inputZoneId.toStringUtf8(), ZoneId.SHORT_IDS);
long offsetTimestamp = packDateTimeWithZone(timestamp, zoneId.toString());
return timestamp + ((timeZoneHourFromTimestampWithTimeZone(offsetTimestamp) * 60 + timeZoneMinuteFromTimestampWithTimeZone(offsetTimestamp)) * 60) * 1000;
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!