本文整理了Java中java.time.ZoneOffset.getId()
方法的一些代码示例,展示了ZoneOffset.getId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneOffset.getId()
方法的具体详情如下:
包路径:java.time.ZoneOffset
类名称:ZoneOffset
方法名:getId
[英]Gets the normalized zone offset ID.
The ID is minor variation to the standard ISO-8601 formatted string for the offset. There are three formats:
代码示例来源:origin: prestodb/presto
private static SqlTimeWithTimeZone toTimeWithTimeZone(OffsetTime offsetTime)
{
return new SqlTimeWithTimeZone(
millisUtc(offsetTime),
TimeZoneKey.getTimeZoneKey(offsetTime.getOffset().getId()));
}
代码示例来源:origin: apache/tinkerpop
@Override
public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final ZoneOffset zoneOffset) {
output.writeString(zoneOffset.getId());
}
代码示例来源:origin: hibernate/hibernate-search
@Override
public String objectToString(Object object) {
if ( object == null ) {
return null;
}
ZoneOffset offSet = (ZoneOffset) object;
return offSet.getId();
}
代码示例来源:origin: de.juplo/jpa-converters
@Override
public String convertToDatabaseColumn(ZoneOffset offset)
{
if (offset == null)
return null;
return offset.getId();
}
代码示例来源:origin: org.jsimpledb/jsimpledb-coreapi
@Override
public String toParseableString(ZoneOffset zoneOffset) {
return zoneOffset.getId();
}
代码示例来源:origin: javers/javers
@Override
public String serialize(ZoneOffset sourceValue) {
return sourceValue.getId();
}
代码示例来源:origin: net.dongliu/gson-java8-datatype
@Override
public void write(JsonWriter out, ZoneOffset zoneOffset) throws IOException {
if (zoneOffset == null) {
out.nullValue();
return;
}
out.value(zoneOffset.getId());
}
代码示例来源:origin: stackoverflow.com
ZoneOffset myOffset = ZonedDateTime.now().getOffset();
System.out.println("ZoneOffset is " + myOffset.getId());
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String currentDate = dateFormat.format(new Date());
System.out.println(currentDate + myOffset.getId());
代码示例来源:origin: stackoverflow.com
Calendar cl = Calendar.getInstance();
ZoneOffset offset = ZoneOffset.of(ZoneId.SHORT_IDS.get("EST"));
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'"+offset.getId()+"'");
formatter.format(cl.getTime());
代码示例来源:origin: eclipse/hawkbit
protected static String getTestTimeZone() {
final ZonedDateTime currentTime = ZonedDateTime.now();
return currentTime.getOffset().getId().replace("Z", "+00:00");
}
}
代码示例来源:origin: org.jadira.usertype/usertype.extended
private Calendar resolveCalendar(ZoneOffset databaseZone) {
String id = databaseZone.getId();
if (Arrays.binarySearch(TimeZone.getAvailableIDs(), id) != -1) {
return Calendar.getInstance(TimeZone.getTimeZone(id));
} else {
return null;
}
}
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-repository-test
protected static String getTestTimeZone() {
final ZonedDateTime currentTime = ZonedDateTime.now();
return currentTime.getOffset().getId().replace("Z", "+00:00");
}
代码示例来源:origin: org.eclipse/yasson
@Override
protected void serialize(ZoneOffset obj, JsonGenerator generator, Marshaller marshaller) {
generator.write(obj.getId());
}
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
/**
* Get list of all time zone offsets supported.
*/
private static List<String> getAllTimeZones() {
final List<String> lst = ZoneId.getAvailableZoneIds().stream()
.map(id -> ZonedDateTime.now(ZoneId.of(id)).getOffset().getId().replace("Z", "+00:00")).distinct()
.collect(Collectors.toList());
lst.sort(null);
return lst;
}
代码示例来源:origin: com.sqlapp/sqlapp-core
@Override
public TimeZone convertObject(Object value) {
if (isEmpty(value)){
return getDefaultValue();
}else if (value instanceof TimeZone){
return (TimeZone)value;
}else if (value instanceof ZoneId){
return TimeZone.getTimeZone(((ZoneId)value).getId());
}else if (value instanceof ZoneOffset){
return TimeZone.getTimeZone(((ZoneOffset)value).getId());
}
return TimeZone.getTimeZone(value.toString());
}
代码示例来源:origin: org.eclipse.hawkbit/hawkbit-ui
/**
* Get time zone of the browser client to be used as default.
*/
private static String getClientTimeZone() {
return ZonedDateTime.now(SPDateTimeUtil.getTimeZoneId(SPDateTimeUtil.getBrowserTimeZone())).getOffset().getId()
.replaceAll("Z", "+00:00");
}
代码示例来源:origin: eclipse/hawkbit
/**
* Get time zone of the browser client to be used as default.
*/
private static String getClientTimeZone() {
return ZonedDateTime.now(SPDateTimeUtil.getTimeZoneId(SPDateTimeUtil.getBrowserTimeZone())).getOffset().getId()
.replaceAll("Z", "+00:00");
}
代码示例来源:origin: ngs-doo/dsl-json
private static void writeTimezone(final int position, final OffsetDateTime dt, final JsonWriter sw) {
final ZoneOffset zone = dt.getOffset();
sw.advance(position);
sw.writeAscii(zone.getId());
sw.writeByte(JsonWriter.QUOTE);
}
代码示例来源:origin: prestosql/presto
private static SqlTimeWithTimeZone toTimeWithTimeZone(OffsetTime offsetTime)
{
return new SqlTimeWithTimeZone(
millisUtc(offsetTime),
TimeZoneKey.getTimeZoneKey(offsetTime.getOffset().getId()));
}
代码示例来源:origin: io.prestosql/presto-main
private static SqlTimeWithTimeZone toTimeWithTimeZone(OffsetTime offsetTime)
{
return new SqlTimeWithTimeZone(
millisUtc(offsetTime),
TimeZoneKey.getTimeZoneKey(offsetTime.getOffset().getId()));
}
内容来源于网络,如有侵权,请联系作者删除!