List of usage examples for java.time ZonedDateTime withZoneSameInstant
@Override
public ZonedDateTime withZoneSameInstant(ZoneId zone)
From source file:com.github.ibm.domino.client.DominoRestClient.java
public DominoRestClient before(ZonedDateTime value) { parameters.put("before", getDateParameter(value.withZoneSameInstant(ZoneId.of("GMT")))); return this; }
From source file:com.github.lburgazzoli.camel.CaseToIncidentProcessor.java
private Date zonedDateTimeToDate(ZonedDateTime zdt) { return zdt != null ? Date.from(zdt.withZoneSameInstant(ZoneId.of("UTC")).toInstant()) : null; }
From source file:net.straylightlabs.archivo.net.MindCommandRecordingSearch.java
private LocalDateTime parseUTCDateTime(String utcDateTime) { ZonedDateTime utc = ZonedDateTime.parse(utcDateTime + " +0000", DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm:ss ZZ")); return utc.withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(); }
From source file:de.rkl.tools.tzconv.TimezoneConverter.java
private String formatConvertedDateTimes(final ZonedDateTime localDateTime) { final StringBuilder convertedDateTimeBuilder = new StringBuilder(); applicationModel.selectedZoneIds.forEach(zoneId -> { convertedDateTimeBuilder.append(localDateTime.withZoneSameInstant(zoneId).format(dateTimeFormatter)); convertedDateTimeBuilder.append('\n'); });// ww w . ja v a 2 s. c om return convertedDateTimeBuilder.toString(); }
From source file:io.stallion.jobs.Schedule.java
/** * Gets the next datetime matching the schedule, passing in the current * date from which to look. Used for testing. * * @param startingFrom/*from w w w. j a va2s . c om*/ * @return */ public ZonedDateTime nextAt(ZonedDateTime startingFrom) { if (!startingFrom.getZone().equals(getZoneId())) { startingFrom = startingFrom.withZoneSameInstant(getZoneId()); } ZonedDateTime dt = new NextDateTimeFinder(startingFrom).find(); return dt.withZoneSameInstant(ZoneId.of("UTC")); }
From source file:alfio.model.Event.java
public Event(@Column("id") int id, @Column("type") EventType type, @Column("short_name") String shortName, @Column("display_name") String displayName, @Column("location") String location, @Column("latitude") String latitude, @Column("longitude") String longitude, @Column("start_ts") ZonedDateTime begin, @Column("end_ts") ZonedDateTime end, @Column("time_zone") String timeZone, @Column("website_url") String websiteUrl, @Column("external_url") String externalUrl, @Column("file_blob_id") String fileBlobId, @Column("website_t_c_url") String termsAndConditionsUrl, @Column("image_url") String imageUrl, @Column("currency") String currency, @Column("vat") BigDecimal vat, @Column("allowed_payment_proxies") String allowedPaymentProxies, @Column("private_key") String privateKey, @Column("org_id") int organizationId, @Column("locales") int locales, @Column("src_price_cts") int srcPriceInCents, @Column("vat_status") PriceContainer.VatStatus vatStatus, @Column("version") String version, @Column("status") Status status) { this.type = type; this.displayName = displayName; this.websiteUrl = websiteUrl; this.externalUrl = externalUrl; this.termsAndConditionsUrl = termsAndConditionsUrl; this.imageUrl = imageUrl; this.fileBlobId = fileBlobId; final ZoneId zoneId = TimeZone.getTimeZone(timeZone).toZoneId(); this.id = id; this.shortName = shortName; this.location = location; this.latitude = latitude; this.longitude = longitude; this.timeZone = zoneId; this.begin = begin.withZoneSameInstant(zoneId); this.end = end.withZoneSameInstant(zoneId); this.currency = currency; this.vatIncluded = vatStatus == PriceContainer.VatStatus.INCLUDED; this.vat = vat; this.privateKey = privateKey; this.organizationId = organizationId; this.locales = locales; this.allowedPaymentProxies = Arrays.stream(Optional.ofNullable(allowedPaymentProxies).orElse("").split(",")) .filter(StringUtils::isNotBlank).map(PaymentProxy::valueOf).collect(Collectors.toList()); this.vatStatus = vatStatus; this.srcPriceCts = srcPriceInCents; this.version = version; this.status = status; }