- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中java.time.ZoneId.normalized()
方法的一些代码示例,展示了ZoneId.normalized()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneId.normalized()
方法的具体详情如下:
包路径:java.time.ZoneId
类名称:ZoneId
方法名:normalized
[英]Normalizes the time-zone ID, returning a ZoneOffset where possible.
The returns a normalized ZoneId that can be used in place of this ID. The result will have ZoneRules equivalent to those returned by this object, however the ID returned by getId() may be different.
The normalization checks if the rules of this ZoneId have a fixed offset. If they do, then the ZoneOffset equal to that offset is returned. Otherwise this is returned.
[中]标准化时区ID,尽可能返回区域偏移。
返回一个规范化的ZoneId,可以用来代替此ID。结果将具有与此对象返回的ZoneURL等效的ZoneURL,但是getId()返回的ID可能不同。
规范化检查此区域ID的规则是否有固定偏移量。如果是,则返回等于该偏移量的ZoneOffset。否则这将被返回。
代码示例来源:origin: io.permazen/permazen-coreapi
@Override
protected String doForward(ZoneId zoneId) {
if (zoneId == null)
return null;
return zoneId.normalized().getId();
}
代码示例来源:origin: org.jsimpledb/jsimpledb-coreapi
@Override
protected String doForward(ZoneId zoneId) {
if (zoneId == null)
return null;
return zoneId.normalized().getId();
}
代码示例来源:origin: vt-middleware/ldaptive
@Override
public String encodeStringValue(final ZonedDateTime value)
{
if (value.getZone().normalized().equals(ZoneOffset.UTC)) {
return value.format(DATE_FORMAT);
} else {
return value.withZoneSameInstant(ZoneOffset.UTC).format(DATE_FORMAT);
}
}
代码示例来源:origin: org.ldaptive/ldaptive
@Override
public String encodeStringValue(final ZonedDateTime value)
{
if (value.getZone().normalized().equals(ZoneOffset.UTC)) {
return value.format(DATE_FORMAT);
} else {
return value.withZoneSameInstant(ZoneOffset.UTC).format(DATE_FORMAT);
}
}
代码示例来源:origin: ccavanaugh/jgnash
case "HK":
case "US":
final ZonedDateTime zdtUS = lastUpdate.atZone(ZoneId.of("UTC").normalized());
if (zdtUS.getHour() >= 21 && zdtUS.getMinute() > 25) { // 4:25 EST for delayed online sources
result = false;
final ZonedDateTime zdtUK = lastUpdate.atZone(ZoneId.of("UTC").normalized());
if (zdtUK.getHour() >= 21 && zdtUK.getMinute() > 55) { // 4:55 EST for delayed online sources
result = false;
final ZonedDateTime zdtIN = lastUpdate.atZone(ZoneId.of("UTC").normalized());
if (zdtIN.getHour() >= 20 && zdtIN.getMinute() > 55) { // 3:55 EST for delayed online sources
result = false;
代码示例来源:origin: com.github.seratch/java-time-backport
@Override
public boolean print(DateTimePrintContext context, StringBuilder buf) {
ZoneId zone = context.getValue(TemporalQueries.zoneId());
if (zone == null) {
return false;
}
if (zone.normalized() instanceof ZoneOffset) {
buf.append(zone.getId());
return true;
}
Long epochSec = context.getTemporal().getLong(INSTANT_SECONDS);
Instant instant;
if (epochSec != null) {
instant = Instant.ofEpochSecond(epochSec);
} else {
instant = Instant.ofEpochSecond(-200L * 365 * 86400); // about 1770
}
TimeZone tz = TimeZone.getTimeZone(zone.getId());
boolean daylight = zone.getRules().isDaylightSavings(instant);
int tzstyle = (textStyle.asNormal() == TextStyle.FULL ? TimeZone.LONG : TimeZone.SHORT);
String text = tz.getDisplayName(daylight, tzstyle, context.getLocale());
buf.append(text);
return true;
}
代码示例来源:origin: org.mariadb.jdbc/mariadb-java-client
ZoneId zoneId = timeZone.toZoneId().normalized();
if (zoneId instanceof ZoneOffset) {
ZoneOffset zoneOffset = (ZoneOffset) zoneId;
代码示例来源:origin: MariaDB/mariadb-connector-j
ZoneId zoneId = timeZone.toZoneId().normalized();
if (zoneId instanceof ZoneOffset) {
ZoneOffset zoneOffset = (ZoneOffset) zoneId;
代码示例来源:origin: org.mariadb.jdbc/mariadb-java-client
ZoneId zoneId = timeZone.toZoneId().normalized();
if (zoneId instanceof ZoneOffset) {
ZoneOffset zoneOffset = (ZoneOffset) zoneId;
代码示例来源:origin: MariaDB/mariadb-connector-j
ZoneId zoneId = timeZone.toZoneId().normalized();
if (zoneId instanceof ZoneOffset) {
ZoneOffset zoneOffset = (ZoneOffset) zoneId;
代码示例来源:origin: org.kie/kie-dmn-feel
{ "date and time(\"2016-07-29T05:48:23\")", LocalDateTime.of( 2016, 7, 29, 5, 48, 23, 0 ) , null},
{ "date and time( 2016, 7, 29, 5, 48, 23 )", LocalDateTime.of( 2016, 7, 29, 5, 48, 23, 0 ) , null},
{ "date and time(\"2016-07-29T05:48:23Z\")", ZonedDateTime.of(2016, 7, 29, 5, 48, 23, 0, ZoneId.of("Z").normalized()) , null},
{ "date and time( 2016, 7, 29, 5, 48, 23, -5 )", OffsetDateTime.of(2016, 7, 29, 5, 48, 23, 0, ZoneOffset.ofHours( -5 ) ) , null},
{ "date and time(\"2016-07-29T05:48:23.765-05:00\")", DateTimeFormatter.ISO_DATE_TIME.parse( "2016-07-29T05:48:23.765-05:00", ZonedDateTime::from ) , null},
{ "date and time(\"2016-07-29T05:48:23Z\") + duration( \"P1Y1M\" )", ZonedDateTime.of(2017, 8, 29, 5, 48, 23, 0, ZoneId.of("Z").normalized()) , null},
{ "date and time(\"2016-07-29T05:48:23\") + duration( \"P1Y1M\" )", LocalDateTime.of(2017, 8, 29, 5, 48, 23, 0) , null},
{ "date and time(\"2016-07-29T05:48:23Z\") + duration( \"P1DT1H1M\" )", ZonedDateTime.of(2016, 7, 30, 6, 49, 23, 0, ZoneId.of("Z").normalized()) , null},
{ "date and time(\"2016-07-29T05:48:23\") + duration( \"P1DT1H1M\" )", LocalDateTime.of(2016, 7, 30, 6, 49, 23, 0) , null},
{ "date(\"2016-07-29\") + duration( \"P3D\" )", LocalDate.of(2016, 8, 1) , null},
{ "duration( \"P3D\" ) + date(\"2016-07-29\")", LocalDate.of(2016, 8, 1) , null},
{ "duration( \"P1Y1M\" ) + date(\"2016-07-29\")", LocalDate.of(2017, 8, 29) , null},
{ "duration( \"P1Y1M\" ) + date and time(\"2016-07-29T05:48:23Z\")", ZonedDateTime.of(2017, 8, 29, 5, 48, 23, 0, ZoneId.of("Z").normalized()) , null},
{ "duration( \"P1Y1M\" ) + date and time(\"2016-07-29T05:48:23\")", LocalDateTime.of(2017, 8, 29, 5, 48, 23, 0) , null},
{ "duration( \"P1DT1H1M\" ) + date and time(\"2016-07-29T05:48:23Z\")", ZonedDateTime.of(2016, 7, 30, 6, 49, 23, 0, ZoneId.of("Z").normalized()) , null},
{ "duration( \"P1DT1H1M\" ) + date and time(\"2016-07-29T05:48:23\")", LocalDateTime.of(2016, 7, 30, 6, 49, 23, 0) , null},
{ "time(\"22:57:00\") + duration( \"PT1H1M\" )", LocalTime.of(23, 58, 0) , null},
{ "date and time(\"2016-07-29T05:48:23Z\") - duration( \"P1Y1M\" )", ZonedDateTime.of(2015, 6, 29, 5, 48, 23, 0, ZoneId.of("Z").normalized()) , null},
{ "date and time(\"2016-07-29T05:48:23\") - duration( \"P1Y1M\" )", LocalDateTime.of(2015, 6, 29, 5, 48, 23, 0) , null},
{ "date and time(\"2016-07-29T05:48:23Z\") - duration( \"P1DT1H1M\" )", ZonedDateTime.of(2016, 7, 28, 4, 47, 23, 0, ZoneId.of("Z").normalized()) , null},
{ "date and time(\"2016-07-29T05:48:23\") - duration( \"P1DT1H1M\" )", LocalDateTime.of(2016, 7, 28, 4, 47, 23, 0) , null},
{ "date(\"2016-07-29\") - duration( \"P1D\" )", LocalDate.of(2016, 7, 28) , null},
代码示例来源:origin: com.github.seratch/java-time-backport
ZoneId normalizedOffset = overrideZone.normalized();
ZoneOffset temporalOffset = temporal.query(TemporalQueries.offset());
if (normalizedOffset instanceof ZoneOffset && temporalOffset != null && normalizedOffset.equals(temporalOffset) == false) {
我想了解 Ruby 方法 methods() 是如何工作的。 我尝试使用“ruby 方法”在 Google 上搜索,但这不是我需要的。 我也看过 ruby-doc.org,但我没有找到这种方法。
Test 方法 对指定的字符串执行一个正则表达式搜索,并返回一个 Boolean 值指示是否找到匹配的模式。 object.Test(string) 参数 object 必选项。总是一个
Replace 方法 替换在正则表达式查找中找到的文本。 object.Replace(string1, string2) 参数 object 必选项。总是一个 RegExp 对象的名称。
Raise 方法 生成运行时错误 object.Raise(number, source, description, helpfile, helpcontext) 参数 object 应为
Execute 方法 对指定的字符串执行正则表达式搜索。 object.Execute(string) 参数 object 必选项。总是一个 RegExp 对象的名称。 string
Clear 方法 清除 Err 对象的所有属性设置。 object.Clear object 应为 Err 对象的名称。 说明 在错误处理后,使用 Clear 显式地清除 Err 对象。此
CopyFile 方法 将一个或多个文件从某位置复制到另一位置。 object.CopyFile source, destination[, overwrite] 参数 object 必选
Copy 方法 将指定的文件或文件夹从某位置复制到另一位置。 object.Copy destination[, overwrite] 参数 object 必选项。应为 File 或 F
Close 方法 关闭打开的 TextStream 文件。 object.Close object 应为 TextStream 对象的名称。 说明 下面例子举例说明如何使用 Close 方
BuildPath 方法 向现有路径后添加名称。 object.BuildPath(path, name) 参数 object 必选项。应为 FileSystemObject 对象的名称
GetFolder 方法 返回与指定的路径中某文件夹相应的 Folder 对象。 object.GetFolder(folderspec) 参数 object 必选项。应为 FileSy
GetFileName 方法 返回指定路径(不是指定驱动器路径部分)的最后一个文件或文件夹。 object.GetFileName(pathspec) 参数 object 必选项。应为
GetFile 方法 返回与指定路径中某文件相应的 File 对象。 object.GetFile(filespec) 参数 object 必选项。应为 FileSystemObject
GetExtensionName 方法 返回字符串,该字符串包含路径最后一个组成部分的扩展名。 object.GetExtensionName(path) 参数 object 必选项。应
GetDriveName 方法 返回包含指定路径中驱动器名的字符串。 object.GetDriveName(path) 参数 object 必选项。应为 FileSystemObjec
GetDrive 方法 返回与指定的路径中驱动器相对应的 Drive 对象。 object.GetDrive drivespec 参数 object 必选项。应为 FileSystemO
GetBaseName 方法 返回字符串,其中包含文件的基本名 (不带扩展名), 或者提供的路径说明中的文件夹。 object.GetBaseName(path) 参数 object 必
GetAbsolutePathName 方法 从提供的指定路径中返回完整且含义明确的路径。 object.GetAbsolutePathName(pathspec) 参数 object
FolderExists 方法 如果指定的文件夹存在,则返回 True;否则返回 False。 object.FolderExists(folderspec) 参数 object 必选项
FileExists 方法 如果指定的文件存在返回 True;否则返回 False。 object.FileExists(filespec) 参数 object 必选项。应为 FileS
我是一名优秀的程序员,十分优秀!