import java.time.ZoneId; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.TextStyle; import java.util.Locale; import java.util.Set; Set<String> zoneIds = ZoneId.getAvailableZoneIds(); for (String zoneId : zoneIds) { ZoneId zone = ZoneId.of(zoneId); ZonedDateTime zonedDateTime = ZonedDateTime.now(zone); ZoneOffset offset = zonedDateTime.getOffset(); String longName = zone.getDisplayName(TextStyle.FULL, Locale.ENGLISH); System.out.println("(" + offset + ") " + zoneId + ", " + longName); }
if (applyZone) { finalQuery = format("set time zone '%s'", checkLiteral(zoneId.getDisplayName(NARROW, ENGLISH))) + "; " + query; } else { finalQuery = query;
/** * Returns the name of this zone formatted according to the {@link java.time.format.TextStyle#FULL} text style * for the provided {@link java.util.Locale}. * * @param self a ZoneId * @param locale a Locale * @return the full display name of the ZoneId * @since 2.5.0 */ public static String getFullName(final ZoneId self, Locale locale) { return self.getDisplayName(TextStyle.FULL, locale); }
/** * Returns the name of this zone formatted according to the {@link java.time.format.TextStyle#SHORT} text style * for the provided {@link java.util.Locale}. * * @param self a ZoneId * @param locale a Locale * @return the short display name of the ZoneId * @since 2.5.0 */ public static String getShortName(final ZoneId self, Locale locale) { return self.getDisplayName(TextStyle.SHORT, locale); }
public String getText(Object element) { if (element instanceof ZoneId) { return ((ZoneId) element).getDisplayName(TextStyle.FULL, Locale.getDefault()); } else { return ""; } }
public boolean select(Viewer v, Object parent, Object element) { if (element instanceof ZoneId) { ZoneId zone = (ZoneId) element; String displayName = zone.getDisplayName(TextStyle.FULL, Locale.getDefault()); return displayName.contains(pattern); } else { return true; } } }
public DateTimeFormatter build() { DateTimeFormatter dateTimeFormatter = builder.toFormatter(); if (!zoneWasSpecified) { dateTimeFormatter = dateTimeFormatter.withZone(defaultZone); LOG.warn("The timestamp format \"{}\" does NOT contain a timezone so we assume \"{}\".", strfformat, defaultZone.getDisplayName(TextStyle.SHORT, Locale.ENGLISH)); } return dateTimeFormatter; }
@Override public Object exec(List list) throws TemplateModelException { return getObject().getDisplayName(findTextStyle(list), findLocale(list)); }
@Override public String getAsString() throws TemplateModelException { return getObject().getDisplayName(TextStyle.FULL, Environment.getCurrentEnvironment().getLocale()); }
p.printf("%s encoding: %s%n", indent, Charset.defaultCharset()); p.printf("%s timezone: %s (%s) %s%n", indent, zi, zi.getDisplayName(TextStyle.FULL, Locale.getDefault()), zi.getRules().getOffset(instant).toString()); p.printf("%swatch service: %s%n", indent, getServer().getWatchServiceClassname());
/** * {@inheritDoc} * * @throws SuperCsvCellProcessorException if value is null or not a ZoneId */ public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof ZoneId) ) { throw new SuperCsvCellProcessorException(ZoneId.class, value, context, this); } final ZoneId zoneId = (ZoneId) value; final String result; if (textStyle != null && locale != null) { result = zoneId.getDisplayName(textStyle, locale); } else { result = zoneId.toString(); } return next.execute(result, context); }
public void exec(CLIContext cli, String[] args) throws Exception { ZoneId zi = ZoneId.systemDefault(); Instant i = Instant.now(); cli.println( " Zone ID: " + zi + " (" + zi.getDisplayName(TextStyle.FULL, Locale.getDefault()) + ") " + zi.getRules().getOffset(i) ); cli.println (" UTC: " + i); ZoneOffsetTransition tran = zi.getRules().nextTransition(i); if (tran != null) { Instant in = tran.getInstant(); cli.println (" Next transition: " + in + " (" + in.atZone(zi) + ")"); } List<ZoneOffsetTransitionRule> l = zi.getRules().getTransitionRules(); for (ZoneOffsetTransitionRule r : l) { cli.println (" Transition rule: " + r); } } }
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) { final String flinkVersion = EnvironmentInformation.getVersion(); final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation(); final String flinkRevision; if (revision != null) { flinkRevision = revision.commitId + " @ " + revision.commitDate; } else { flinkRevision = "unknown revision"; } return new DashboardConfiguration( refreshInterval, zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()), // convert zone date time into offset in order to not do the day light saving adaptions wrt the offset zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000, flinkVersion, flinkRevision); } }
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) { final String flinkVersion = EnvironmentInformation.getVersion(); final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation(); final String flinkRevision; if (revision != null) { flinkRevision = revision.commitId + " @ " + revision.commitDate; } else { flinkRevision = "unknown revision"; } return new DashboardConfiguration( refreshInterval, zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()), // convert zone date time into offset in order to not do the day light saving adaptions wrt the offset zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000, flinkVersion, flinkRevision); } }
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) { final String flinkVersion = EnvironmentInformation.getVersion(); final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation(); final String flinkRevision; if (revision != null) { flinkRevision = revision.commitId + " @ " + revision.commitDate; } else { flinkRevision = "unknown revision"; } return new DashboardConfiguration( refreshInterval, zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()), // convert zone date time into offset in order to not do the day light saving adaptions wrt the offset zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000, flinkVersion, flinkRevision); } }
aCurrentDTZ.getId () + " - " + aCurrentDTZ.getDisplayName (TextStyle.FULL, aDisplayLocale))); final HCTable aTable = new HCTable (new DTCol (EText.MSG_ID.getDisplayText (aDisplayLocale)).setInitialSorting (ESortOrder.ASCENDING), aRow.addCell (aDTZ.getDisplayName (TextStyle.FULL, aDisplayLocale)); aRow.addCell (aDTZ.getDisplayName (TextStyle.SHORT, aDisplayLocale)); aRow.addCell (Duration.ofSeconds (aZO.getTotalSeconds ()).toString ()); aRow.addCell (EPhotonCoreText.getYesOrNo (aZR.isFixedOffset (), aDisplayLocale));
aCurrentDTZ.getId () + " - " + aCurrentDTZ.getDisplayName (TextStyle.FULL, aDisplayLocale))); final HCTable aTable = new HCTable (new DTCol (EText.MSG_ID.getDisplayText (aDisplayLocale)).setInitialSorting (ESortOrder.ASCENDING), aRow.addCell (aDTZ.getDisplayName (TextStyle.FULL, aDisplayLocale)); aRow.addCell (aDTZ.getDisplayName (TextStyle.SHORT, aDisplayLocale)); aRow.addCell (Duration.ofSeconds (aZO.getTotalSeconds ()).toString ()); aRow.addCell (EPhotonCoreText.getYesOrNo (aZR.isFixedOffset (), aDisplayLocale));
dateTime.getZone().getDisplayName(TextStyle.FULL, locale));