List of usage examples for java.time LocalDateTime getMinute
public int getMinute()
From source file:Main.java
public static void main(String[] args) { LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 01); System.out.println(a.getMinute()); }
From source file:Main.java
public static void main(String[] argv) { LocalDate today = LocalDate.now(); System.out.println(String.format("Year : %s Month : %s day : %s", today.getYear(), today.getMonthValue(), today.getDayOfMonth()));/*from w w w. j a va 2s. com*/ LocalDateTime time = LocalDateTime.now(); System.out.println( String.format("Hour : %s Mins : %s Sec : %s", time.getHour(), time.getMinute(), time.getSecond())); }
From source file:io.hawkcd.agent.utilities.ReportAppender.java
private static String getTimeStamp() { // e.g. [10:51:50:564]: LocalDateTime now = LocalDateTime.now(); String format = String.format("[%02d:%02d:%02d]:", now.getHour(), now.getMinute(), now.getSecond()); return format; }
From source file:net.ceos.project.poi.annotated.bean.MultiTypeObjectBuilder.java
/** * Validate the MultiTypeObject based on the object build with the method * 'buildMultiTypeObject'//from w w w .j a v a 2 s . c o m * * @param toValidate * the object to validate */ public static void validateMultiTypeObject(MultiTypeObject toValidate) { MultiTypeObject base = buildMultiTypeObject(); Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); Calendar calendarUnmarshal = Calendar.getInstance(); calendarUnmarshal.setTime(toValidate.getDateAttribute()); assertEquals(calendar.get(Calendar.YEAR), calendarUnmarshal.get(Calendar.YEAR)); assertEquals(calendar.get(Calendar.MONTH), calendarUnmarshal.get(Calendar.MONTH)); assertEquals(calendar.get(Calendar.DAY_OF_MONTH), calendarUnmarshal.get(Calendar.DAY_OF_MONTH)); LocalDate localDate = LocalDate.now(); assertEquals(localDate.getDayOfMonth(), toValidate.getLocalDateAttribute().getDayOfMonth()); assertEquals(localDate.getMonth(), toValidate.getLocalDateAttribute().getMonth()); assertEquals(localDate.getYear(), toValidate.getLocalDateAttribute().getYear()); LocalDateTime localDateTime = LocalDateTime.now(); assertEquals(localDateTime.getDayOfMonth(), toValidate.getLocalDateTimeAttribute().getDayOfMonth()); assertEquals(localDateTime.getMonth(), toValidate.getLocalDateTimeAttribute().getMonth()); assertEquals(localDateTime.getYear(), toValidate.getLocalDateTimeAttribute().getYear()); assertEquals(localDateTime.getHour(), toValidate.getLocalDateTimeAttribute().getHour()); /* it is possible to have an error below due the time of execution of the test */ assertEquals(localDateTime.getMinute(), toValidate.getLocalDateTimeAttribute().getMinute()); assertEquals(base.getStringAttribute(), toValidate.getStringAttribute()); assertEquals(base.getIntegerAttribute(), toValidate.getIntegerAttribute()); assertEquals(base.getDoubleAttribute(), toValidate.getDoubleAttribute()); assertEquals(base.getLongAttribute(), toValidate.getLongAttribute()); assertEquals(base.getBooleanAttribute(), toValidate.getBooleanAttribute()); assertEquals(base.getJob().getJobCode(), toValidate.getJob().getJobCode()); assertEquals(base.getJob().getJobFamily(), toValidate.getJob().getJobFamily()); assertEquals(base.getJob().getJobName(), toValidate.getJob().getJobName()); assertEquals(base.getIntegerPrimitiveAttribute(), toValidate.getIntegerPrimitiveAttribute()); assertEquals(base.getDoublePrimitiveAttribute(), toValidate.getDoublePrimitiveAttribute()); assertEquals(base.getLongPrimitiveAttribute(), toValidate.getLongPrimitiveAttribute()); assertEquals(base.isBooleanPrimitiveAttribute(), toValidate.isBooleanPrimitiveAttribute()); assertEquals(base.getAddressInfo().getAddress(), toValidate.getAddressInfo().getAddress()); assertEquals(base.getAddressInfo().getNumber(), toValidate.getAddressInfo().getNumber()); assertEquals(base.getAddressInfo().getCity(), toValidate.getAddressInfo().getCity()); assertEquals(base.getAddressInfo().getCityCode(), toValidate.getAddressInfo().getCityCode()); assertEquals(base.getAddressInfo().getCountry(), toValidate.getAddressInfo().getCountry()); assertEquals(base.getFloatAttribute(), toValidate.getFloatAttribute()); assertEquals(base.getFloatPrimitiveAttribute(), toValidate.getFloatPrimitiveAttribute()); assertEquals(base.getUnitFamily(), toValidate.getUnitFamily()); assertEquals(base.getBigDecimalAttribute(), toValidate.getBigDecimalAttribute()); assertEquals(base.getShortAttribute(), toValidate.getShortAttribute()); assertEquals(base.getShortPrimitiveAttribute(), toValidate.getShortPrimitiveAttribute()); // TODO add new validation below }
From source file:net.atomique.ksar.graph.Graph.java
public int parse_line(LocalDateTime ldt, String s) { Second now = new Second(ldt.getSecond(), ldt.getMinute(), ldt.getHour(), ldt.getDayOfMonth(), ldt.getMonthValue(), ldt.getYear()); parse_line(now, s);// w ww .j a v a 2s . c o m return 0; }
From source file:net.atomique.ksar.graph.Graph.java
private Second convertLocalDateTimeToSecond(LocalDateTime ldt) { int day = ldt.getDayOfMonth(); int month = ldt.getMonthValue(); int year = ldt.getYear(); int hour = ldt.getHour(); int minute = ldt.getMinute(); int second = ldt.getSecond(); return new Second(second, minute, hour, day, month, year); }
From source file:dk.dma.ais.packet.AisPacketCSVOutputSink.java
protected String formatEta(Date eta) { LocalDateTime time = LocalDateTime.ofInstant(Instant.ofEpochMilli(eta.getTime()), ZoneId.systemDefault()); return formatEta(time.getDayOfMonth(), time.getMonthValue(), time.getHour(), time.getMinute()); }
From source file:org.apache.openmeetings.web.user.calendar.CalendarPanel.java
@Override protected void onInitialize() { final Form<Date> form = new Form<>("form"); add(form);//w ww . jav a 2s. c o m dialog = new AppointmentDialog("appointment", this, new CompoundPropertyModel<>(getDefault())); add(dialog); boolean isRtl = isRtl(); Options options = new Options(); options.set("isRTL", isRtl); options.set("height", Options.asString("parent")); options.set("header", isRtl ? "{left: 'agendaDay,agendaWeek,month', center: 'title', right: 'today nextYear,next,prev,prevYear'}" : "{left: 'prevYear,prev,next,nextYear today', center: 'title', right: 'month,agendaWeek,agendaDay'}"); options.set("allDaySlot", false); options.set("axisFormat", Options.asString("H(:mm)")); options.set("defaultEventMinutes", 60); options.set("timeFormat", Options.asString("H(:mm)")); options.set("buttonText", new JSONObject().put("month", getString("801")).put("week", getString("800")) .put("day", getString("799")).put("today", getString("1555")).toString()); options.set("locale", Options.asString(WebSession.get().getLocale().toLanguageTag())); calendar = new Calendar("calendar", new AppointmentModel(), options) { private static final long serialVersionUID = 1L; @Override protected void onInitialize() { super.onInitialize(); add(new CalendarFunctionsBehavior(getMarkupId())); } @Override public boolean isSelectable() { return true; } @Override public boolean isDayClickEnabled() { return true; } @Override public boolean isEventClickEnabled() { return true; } @Override public boolean isEventDropEnabled() { return true; } @Override public boolean isEventResizeEnabled() { return true; } //no need to override onDayClick @Override public void onSelect(AjaxRequestTarget target, CalendarView view, LocalDateTime start, LocalDateTime end, boolean allDay) { Appointment a = getDefault(); LocalDateTime s = start, e = end; if (CalendarView.month == view) { LocalDateTime now = ZonedDateTime.now(getZoneId()).toLocalDateTime(); s = start.withHour(now.getHour()).withMinute(now.getMinute()); e = s.plus(1, ChronoUnit.HOURS); } a.setStart(getDate(s)); a.setEnd(getDate(e)); dialog.setModelObjectWithAjaxTarget(a, target); dialog.open(target); } @Override public void onEventClick(AjaxRequestTarget target, CalendarView view, String eventId) { if (!StringUtils.isNumeric(eventId)) { return; } Appointment a = apptDao.get(Long.valueOf(eventId)); dialog.setModelObjectWithAjaxTarget(a, target); dialog.open(target); } @Override public void onEventDrop(AjaxRequestTarget target, String eventId, long delta, boolean allDay) { if (!StringUtils.isNumeric(eventId)) { refresh(target); return; } Appointment a = apptDao.get(Long.valueOf(eventId)); if (!AppointmentDialog.isOwner(a)) { return; } java.util.Calendar cal = WebSession.getCalendar(); cal.setTime(a.getStart()); cal.add(java.util.Calendar.MILLISECOND, (int) delta); a.setStart(cal.getTime()); cal.setTime(a.getEnd()); cal.add(java.util.Calendar.MILLISECOND, (int) delta); a.setEnd(cal.getTime()); apptDao.update(a, getUserId()); if (a.getCalendar() != null) { updatedeleteAppointment(target, CalendarDialog.DIALOG_TYPE.UPDATE_APPOINTMENT, a); } } @Override public void onEventResize(AjaxRequestTarget target, String eventId, long delta) { if (!StringUtils.isNumeric(eventId)) { refresh(target); return; } Appointment a = apptDao.get(Long.valueOf(eventId)); if (!AppointmentDialog.isOwner(a)) { return; } java.util.Calendar cal = WebSession.getCalendar(); cal.setTime(a.getEnd()); cal.add(java.util.Calendar.MILLISECOND, (int) delta); a.setEnd(cal.getTime()); apptDao.update(a, getUserId()); if (a.getCalendar() != null) { updatedeleteAppointment(target, CalendarDialog.DIALOG_TYPE.UPDATE_APPOINTMENT, a); } } }; form.add(calendar); populateGoogleCalendars(); add(refreshTimer); add(syncTimer); calendarDialog = new CalendarDialog("calendarDialog", this, new CompoundPropertyModel<>(getDefaultCalendar())); add(calendarDialog); calendarListContainer.setOutputMarkupId(true); calendarListContainer .add(new ListView<OmCalendar>("items", new LoadableDetachableModel<List<OmCalendar>>() { private static final long serialVersionUID = 1L; @Override protected List<OmCalendar> load() { List<OmCalendar> cals = new ArrayList<>(apptManager.getCalendars(getUserId())); cals.addAll(apptManager.getGoogleCalendars(getUserId())); return cals; } }) { private static final long serialVersionUID = 1L; @Override protected void populateItem(final ListItem<OmCalendar> item) { item.setOutputMarkupId(true); final OmCalendar cal = item.getModelObject(); item.add(new WebMarkupContainer("item").add(new Label("name", cal.getTitle()))); item.add(new AjaxEventBehavior(EVT_CLICK) { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { calendarDialog.open(target, CalendarDialog.DIALOG_TYPE.UPDATE_CALENDAR, cal); target.add(calendarDialog); } }); } }); add(new Button("syncCalendarButton").add(new AjaxEventBehavior(EVT_CLICK) { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { syncCalendar(target); } })); add(new Button("submitCalendar").add(new AjaxEventBehavior(EVT_CLICK) { private static final long serialVersionUID = 1L; @Override protected void onEvent(AjaxRequestTarget target) { calendarDialog.open(target, CalendarDialog.DIALOG_TYPE.UPDATE_CALENDAR, getDefaultCalendar()); target.add(calendarDialog); } })); add(calendarListContainer); super.onInitialize(); }
From source file:msi.gama.util.GamaDate.java
public IList<?> listValue(final IScope scope, final IType<?> ct) { final LocalDateTime ld = LocalDateTime.from(internal); return GamaListFactory.create(scope, ct, ld.getYear(), ld.getMonthValue(), ld.getDayOfWeek().getValue(), ld.getHour(), ld.getMinute(), ld.getSecond()); }
From source file:com.snowy.data.java
public HashMap<Integer, String> chatsSince(int id, int lastMessageid) { HashMap<Integer, String> hm = new HashMap<>(); try {// w ww. j a v a2s. c o m PreparedStatement ps = con.prepareStatement( "select Timestamp,Message,sender,Message_id from chat where GameId =? and Message_id > ?"); ps.setInt(1, id); ps.setInt(2, lastMessageid); ResultSet rs = ps.executeQuery(); rs.beforeFirst(); while (rs.next()) { LocalDateTime t = rs.getTimestamp("Timestamp").toLocalDateTime(); String time = String.format("%02d:%02d", t.getHour(), t.getMinute()); hm.put(rs.getInt("Message_id"), time + " " + rs.getString("sender") + ": " + rs.getString("Message") + "\n"); } //ps.close(); //rs.close(); } catch (SQLException ex) { Logger.getLogger(data.class.getName()).log(Level.SEVERE, null, ex); } return hm; }