List of usage examples for java.time LocalDate atTime
public LocalDateTime atTime(int hour, int minute, int second)
From source file:Main.java
public static void main(String[] args) { LocalDate a = LocalDate.of(2014, 6, 30); LocalDateTime l = a.atTime(2, 3, 4); System.out.println(l);/*from w w w . j a va 2 s. c om*/ }
From source file:net.nikr.eve.jeveasset.gui.tabs.tracker.TrackerTab.java
private Date getToDate() { LocalDate date = jTo.getDate(); if (date == null) { return null; }/*from ww w .jav a 2 s . co m*/ Instant instant = date.atTime(23, 59, 59).atZone(ZoneId.of("GMT")).toInstant(); //End of day - GMT return Date.from(instant); }
From source file:serposcope.controllers.admin.DebugController.java
@FilterWith(XSRFFilter.class) public Result dryRun(Context context, @Param("startDate") String start, @Param("endDate") String end) { long _start = System.currentTimeMillis(); FlashScope flash = context.getFlashScope(); LocalDate startDate = null;/*from w ww.java 2s. c o m*/ LocalDate endDate = null; try { startDate = LocalDate.parse(start); endDate = LocalDate.parse(end); } catch (Exception ex) { } if (startDate == null || endDate == null || startDate.isAfter(endDate)) { flash.error("error.invalidDate"); return Results.redirect(router.getReverseRoute(DebugController.class, "debug")); } Run lastRun = baseDB.run.findLast(Module.GOOGLE, null, null); if (lastRun != null && lastRun.getDay().isAfter(startDate)) { flash.error("error.invalidDate"); return Results.redirect(router.getReverseRoute(DebugController.class, "debug")); } LocalDate date = LocalDate.from(startDate); GoogleSettings ggOptions = googleDB.options.get(); int minPauseBetweenPageSec = ggOptions.getMinPauseBetweenPageSec(); int maxPauseBetweenPageSec = ggOptions.getMaxPauseBetweenPageSec(); ggOptions.setMinPauseBetweenPageSec(0); ggOptions.setMaxPauseBetweenPageSec(0); googleDB.options.update(ggOptions); try { while (date.isBefore(endDate)) { LOG.debug("dry run {}", date); if (!taskManager .startGoogleTask(new Run(Run.Mode.MANUAL, Module.GOOGLE, date.atTime(13, 37, 00)))) { LOG.error("can't startGoogleTask"); flash.error("can't startGoogleTask"); return Results.redirect(router.getReverseRoute(DebugController.class, "debug")); } taskManager.joinGoogleTask(); date = date.plusDays(1); } } catch (Exception ex) { LOG.error("an error occured", ex); flash.error("an error occured"); return Results.redirect(router.getReverseRoute(DebugController.class, "debug")); } finally { ggOptions.setMinPauseBetweenPageSec(minPauseBetweenPageSec); ggOptions.setMaxPauseBetweenPageSec(maxPauseBetweenPageSec); googleDB.options.update(ggOptions); } LOG.debug("dry run timing : {}", DurationFormatUtils.formatDurationHMS(System.currentTimeMillis() - _start)); flash.success("ok"); return Results.redirect(router.getReverseRoute(DebugController.class, "debug")); }