private static Trigger buildTrigger(Instant triggerDateTime, JobKey key) { return TriggerBuilder.newTrigger() .forJob(key) .startAt(Date.from(triggerDateTime)) .build(); }
return (X) java.sql.Date.from( instant );
@Override @SuppressWarnings("unchecked") public <X> X unwrap(ZonedDateTime zonedDateTime, Class<X> type, WrapperOptions options) { if ( zonedDateTime == null ) { return null; } if ( ZonedDateTime.class.isAssignableFrom( type ) ) { return (X) zonedDateTime; } if ( Calendar.class.isAssignableFrom( type ) ) { return (X) GregorianCalendar.from( zonedDateTime ); } if ( Timestamp.class.isAssignableFrom( type ) ) { return (X) Timestamp.from( zonedDateTime.toInstant() ); } if ( java.sql.Date.class.isAssignableFrom( type ) ) { return (X) java.sql.Date.from( zonedDateTime.toInstant() ); } if ( java.sql.Time.class.isAssignableFrom( type ) ) { return (X) java.sql.Time.from( zonedDateTime.toInstant() ); } if ( Date.class.isAssignableFrom( type ) ) { return (X) Date.from( zonedDateTime.toInstant() ); } if ( Long.class.isAssignableFrom( type ) ) { return (X) Long.valueOf( zonedDateTime.toInstant().toEpochMilli() ); } throw unknownUnwrap( type ); }
@Override @SuppressWarnings("unchecked") public <X> X unwrap(Instant instant, Class<X> type, WrapperOptions options) { if ( instant == null ) { return null; } if ( Instant.class.isAssignableFrom( type ) ) { return (X) instant; } if ( Calendar.class.isAssignableFrom( type ) ) { final ZoneId zoneId = ZoneId.ofOffset( "UTC", ZoneOffset.UTC ); return (X) GregorianCalendar.from( instant.atZone( zoneId ) ); } if ( java.sql.Timestamp.class.isAssignableFrom( type ) ) { return (X) Timestamp.from( instant ); } if ( java.sql.Date.class.isAssignableFrom( type ) ) { return (X) java.sql.Date.from( instant ); } if ( java.sql.Time.class.isAssignableFrom( type ) ) { return (X) java.sql.Time.from( instant ); } if ( java.util.Date.class.isAssignableFrom( type ) ) { return (X) Date.from( instant ); } if ( Long.class.isAssignableFrom( type ) ) { return (X) Long.valueOf( instant.toEpochMilli() ); } throw unknownUnwrap( type ); }
@Override @SuppressWarnings("unchecked") public <X> X unwrap(OffsetDateTime offsetDateTime, Class<X> type, WrapperOptions options) { if ( offsetDateTime == null ) { return null; } if ( OffsetDateTime.class.isAssignableFrom( type ) ) { return (X) offsetDateTime; } if ( Calendar.class.isAssignableFrom( type ) ) { return (X) GregorianCalendar.from( offsetDateTime.toZonedDateTime() ); } if ( Timestamp.class.isAssignableFrom( type ) ) { return (X) Timestamp.from( offsetDateTime.toInstant() ); } if ( java.sql.Date.class.isAssignableFrom( type ) ) { return (X) java.sql.Date.from( offsetDateTime.toInstant() ); } if ( java.sql.Time.class.isAssignableFrom( type ) ) { return (X) java.sql.Time.from( offsetDateTime.toInstant() ); } if ( Date.class.isAssignableFrom( type ) ) { return (X) Date.from( offsetDateTime.toInstant() ); } if ( Long.class.isAssignableFrom( type ) ) { return (X) Long.valueOf( offsetDateTime.toInstant().toEpochMilli() ); } throw unknownUnwrap( type ); }
final DateTimeFormatter dtFormatter = getDateTimeFormatter(valueFormat); LocalDate parsedDate = LocalDate.parse(parameterValue, dtFormatter); date = new java.sql.Date(java.sql.Date.from(parsedDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()).getTime());
assertEquals(Date.from(instant), email.sentDate());
private RetryableException retryable(Throwable ex) { return new RetryableException("", ex, Date.from(Instant.EPOCH)); }
@Override public Object apply(Object o) { if(o instanceof Instant) { return Date.from((Instant) o); } return o; }
@Override protected long utcTime(ZonedDateTime input) { return Date.from(input.toInstant()).getTime(); } }
@Override protected Object convert(Object input) { final LocalDate localDate = (LocalDate) input; final Instant instant = localDate.atStartOfDay(ZONE_ID).toInstant(); return Date.from(instant); }
public static Calendar parseDateBase64(String dateString) { try { dateString = new String(Base64.decodeBase64(dateString.getBytes())); Calendar calendar = Calendar.getInstance(); Instant instant = LocalDate.parse(dateString, dateFormat).atStartOfDay().atZone(ZoneId.systemDefault()).toInstant(); calendar.setTime(Date.from(instant)); return calendar; } catch (Exception exception) { throw new RuntimeException(exception); } }
@Override public void updateTimestamp(boolean save, ZonedDateTime time) throws IOException { delegate.updateTimestamp(save, Date.from(time.toInstant())); }
private static Set<Trigger> buildTrigger(Instant triggerDateTime, JobKey key) { return Collections.singleton(TriggerBuilder.newTrigger() .forJob(key) .startAt(Date.from(triggerDateTime)) .build()); } }
private static Trigger buildTrigger(Instant triggerDateTime, JobKey key) { return TriggerBuilder.newTrigger() .forJob(key) .startAt(Date.from(triggerDateTime)) .build(); }
public V1VoteDto toV1Dto() { return new V1VoteDto(articleId.toString(), voteState, Date.from(updateTime)); } }
@Override protected Object convert(Object input) { final LocalTime localTime = (LocalTime) input; final Instant instant = localTime.atDate(EPOCH_DATE).toInstant(ZoneOffset.UTC); return Date.from(instant); }
public V1ArticleDto toV1Dto() { return new V1ArticleDto(zone.value(), aliasName, articleId.toString(), title, link, content, isExternalLink() ? V1ArticleType.EXTERNAL_LINK : V1ArticleType.SPEAK, Date.from(createTime), authorName, upVote, debateCount, deleted); }
private Object[] getBindArguments(Event event) { return new Object[] { event.getAggregateId().getType(), event.getAggregateId().getId(), Date.from(event.getEventTimestamp().getTimestamp()), event.getEventTimestamp().getStreamId(), event.getProcessingId().orElseThrow(() -> new IllegalArgumentException("Event has no processing id")), event.getEventName().getName(), event.getEventName().getVersion(), event.getParameters().serialise(serialiser), event.getCharacteristics() }; }