List of usage examples for java.time LocalDateTime ofInstant
public static LocalDateTime ofInstant(Instant instant, ZoneId zone)
From source file:com.codepalousa.restlet.raml.DateTimeSerializeConverter.java
@Override public String convert(Date value) { return LocalDateTime.ofInstant(value.toInstant(), ZoneId.systemDefault()).format(formatter); }
From source file:net.NET_INFO.java
/** * ? LocalDateTime/*from w ww. ja va 2 s .c om*/ * @return the current date-time using the system clock and default time-zone. */ public static LocalDateTime getCurrentTime() { return LocalDateTime.ofInstant(Instant.ofEpochMilli(getCurrentMilli()), ZoneId.systemDefault()); }
From source file:com.fizzed.stork.deploy.DeployHelper.java
static public String toVersionDateTime(long millis) { Instant instant = Instant.ofEpochMilli(millis); LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneOffset.UTC); return ldt.format(versionDateTimeFormatter); }
From source file:pe.edu.system.jcmr.util.UtilidadesFx.java
public static LocalDate converterDateToLocalDate(Date date) { Instant instant = Instant.ofEpochMilli(date.getTime()); LocalDate localDate = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()).toLocalDate(); return localDate; }
From source file:io.curly.advisor.integration.event.CreatedReviewHandler.java
@Override public void onApplicationEvent(CreatedReview event) { final Object source = event.getSource(); if (log.isDebugEnabled()) { log.debug("Received application event with source {} at {}", source, LocalDateTime.ofInstant(Instant.ofEpochMilli(event.getTimestamp()), ZoneId.systemDefault())); }// w w w . ja v a 2s .com if (source instanceof Review) { final Review review = (Review) source; reviewEventEmitter.emmit(review); } else { log.warn("Application event source is not instance of review cannot emmit it!"); } }
From source file:com.fizzed.stork.deploy.DeployHelper.java
static public String toFriendlyDateTime(long millis) { Instant instant = Instant.ofEpochMilli(millis); LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneOffset.UTC); return ldt.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME); }
From source file:fi.helsinki.opintoni.service.TimeService.java
public LocalDateTime endOfDayHelsinki(LocalDateTime fromLocalDateTime) { ZonedDateTime zonedDateTime = fromLocalDateTime.atZone(HELSINKI_ZONE_ID).withHour(23).withMinute(59) .withSecond(59);//from w w w. j a va2s .co m return LocalDateTime.ofInstant(zonedDateTime.toInstant(), ZoneId.of("UTC")); }
From source file:edu.usu.sdl.openstorefront.common.util.TimeUtil.java
/** * Get the end of the day passed in//from www.j a v a 2s.co m * * @param date * @return end of the day or null if date was null */ public static Date endOfDay(Date date) { if (date != null) { Instant instant = Instant.ofEpochMilli(date.getTime()); LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); localDateTime = localDateTime.withHour(23).withMinute(59).withSecond(59) .with(ChronoField.MILLI_OF_SECOND, 999); return new Date(localDateTime.toInstant(ZoneOffset.UTC).toEpochMilli()); } return date; }
From source file:se.omegapoint.facepalm.infrastructure.JPADocumentRepository.java
private LocalDateTime date(final Document d) { return d.getDate() != null ? LocalDateTime.ofInstant(d.getDate().toInstant(), systemDefault()) : null; }
From source file:com.yqboots.fss.core.support.FileItemConsumer.java
/** * {@inheritDoc}//w w w . j a v a 2 s . c o m */ @Override public void accept(final Path path) { final File file = path.toFile(); final FileItem item = new FileItem(); item.setName(file.getName()); String relativePath = StringUtils.substringAfter(file.getPath(), root.toString()); item.setPath(relativePath.replace("\\", "/")); item.setLength(file.length()); item.setLastModifiedDate( LocalDateTime.ofInstant(new Date(file.lastModified()).toInstant(), ZoneId.systemDefault())); items.add(item); }