List of usage examples for java.time LocalTime MIDNIGHT
LocalTime MIDNIGHT
To view the source code for java.time LocalTime MIDNIGHT.
Click Source Link
From source file:me.rkfg.xmpp.bot.plugins.FaggotOfTheDayPlugin.java
private Date getFirstTime() { final LocalTime midnight = LocalTime.MIDNIGHT; final LocalDate today = LocalDate.now(); final LocalDateTime todayMidnight = LocalDateTime.of(today, midnight); return Date.from(todayMidnight.atZone(ZoneId.systemDefault()).toInstant()); }
From source file:com.intuit.wasabi.api.pagination.filters.FilterUtil.java
/** * Parses a UI date of the format {@code M/d/yZ} (See {@link DateTimeFormatter}) as it is allowed to be * entered in advanced search fields in the UI. Throws a {@link PaginationException} on failure, notifying the user. * * @param dateString the string as received from the UI * @param timeZoneOffset the user's timezone offset * @return a parsed date/*from w w w . j a v a 2 s .c o m*/ */ public static OffsetDateTime parseUIDate(String dateString, String timeZoneOffset) { try { TemporalAccessor tempAccessor = DateTimeFormatter.ofPattern("M/d/yyyyZ") .parse(dateString + timeZoneOffset); return OffsetDateTime.of(java.time.LocalDate.from(tempAccessor), LocalTime.MIDNIGHT, ZoneOffset.UTC); } catch (DateTimeParseException parseException) { throw new PaginationException( ErrorCode.FILTER_KEY_UNPROCESSABLE, "Wrong format: Can not parse date (" + dateString + ") , must be of " + "format MM/dd/yyyy , e.g. 05/23/2014 or 4/7/2013", parseException); } }
From source file:com.romeikat.datamessie.core.base.dao.impl.DocumentDao.java
public List<Document> getForSourceAndDownloaded(final SharedSessionContract ssc, final long sourceId, final LocalDate downloaded) { final LocalDateTime minDownloaded = LocalDateTime.of(downloaded, LocalTime.MIDNIGHT); final LocalDateTime maxDownloaded = LocalDateTime.of(downloaded.plusDays(1), LocalTime.MIDNIGHT); // Query: Document final EntityWithIdQuery<Document> documentQuery = new EntityWithIdQuery<>(Document.class); documentQuery.addRestriction(Restrictions.eq("sourceId", sourceId)); documentQuery.addRestriction(Restrictions.ge("downloaded", minDownloaded)); documentQuery.addRestriction(Restrictions.lt("downloaded", maxDownloaded)); // Done//from ww w . j av a 2s .c o m final List<Document> entities = documentQuery.listObjects(ssc); return entities; }
From source file:fr.lepellerin.ecole.service.internal.CantineServiceImpl.java
@Override @Transactional(readOnly = true)//from w w w .j a va 2s . c o m public LocalDateTime getLimiteResaCantine(final LocalDate date) { final LocalTime midnight = LocalTime.MIDNIGHT; final LocalDateTime limiteResa = LocalDateTime.of(date, midnight); final ParametreWeb p = this.paramRepo.findOne(EnumParametreWeb.ID_OFFSET_RESA.getId()); int h = 0; int m = 0; if (p != null) { if (p.getValeurParametre().startsWith("-")) { final String[] hm = p.getValeurParametre().substring(1).split(":"); h = -Integer.valueOf(hm[0]); m = Integer.valueOf(hm[1]); } else { String[] hm; if (p.getValeurParametre().startsWith("+")) { hm = p.getValeurParametre().substring(1).split(":"); } else { hm = p.getValeurParametre().split(":"); } h = Integer.valueOf(hm[0]); m = Integer.valueOf(hm[1]); } } return GeDateUtils.addHeureMinute(limiteResa, h, m); }
From source file:objective.taskboard.controller.FollowUpController.java
private String templateDate(Optional<LocalDate> date, ZoneId timezone) { return date.map(d -> ZonedDateTime.of(d, LocalTime.MIDNIGHT, timezone)).orElse(ZonedDateTime.now(timezone)) .format(formatter);/*ww w . j a v a 2s .c o m*/ }
From source file:org.dbflute.solr.cbean.SolrQueryBuilder.java
public static String queryBuilderForRangeSearch(String solrFieldName, LocalDate from, LocalDate to) { Date fromDate = from == null ? null : Date.from(ZonedDateTime.of(from, LocalTime.MIDNIGHT, ZoneId.systemDefault()).toInstant()); Date toDate = to == null ? null : Date.from(ZonedDateTime.of(to, LocalTime.MIDNIGHT, ZoneId.systemDefault()).toInstant()); return queryBuilderForRangeSearch(solrFieldName, fromDate, toDate); }
From source file:org.silverpeas.core.calendar.Recurrence.java
private OffsetDateTime normalize(final Temporal temporal) { OffsetDateTime dateTime = asOffsetDateTime(temporal); if (this.startDate != null) { return TemporalConverter.applyByType(this.startDate, t -> dateTime.with(LocalTime.MIDNIGHT.atOffset(ZoneOffset.UTC)), t -> dateTime.with(t.toOffsetTime())); }//from w ww .j a va 2s . co m return dateTime; }