List of usage examples for org.joda.time LocalDateTime withSecondOfMinute
public LocalDateTime withSecondOfMinute(int second)
From source file:com.axelor.csv.script.ImportDateTime.java
License:Open Source License
public LocalDateTime updateSecond(LocalDateTime dateTime, String second) { if (!Strings.isNullOrEmpty(second)) { Matcher matcher = patternMonth.matcher(second); if (matcher.find()) { Integer seconds = Integer.parseInt(matcher.group()); if (second.startsWith("+")) dateTime = dateTime.plusSeconds(seconds); else if (second.startsWith("-")) dateTime = dateTime.minusSeconds(seconds); else/*w w w . j a va 2 s.c om*/ dateTime = dateTime.withSecondOfMinute(seconds); } } return dateTime; }
From source file:view.schema.AssignedAllRoomsRow.java
public AssignedAllRoomsRow(String shiftName, LocalDateTime startTime, ArrayList<TimeInvestment> shifts, int startHour, int startMinute, int periodLengthHour, int periodLengthMinute) { this.shifts = shifts; this.startTime = startTime; shiftTypeLabel = new RoomTile(shiftName); this.setOrientation(Orientation.HORIZONTAL); this.getChildren().add(shiftTypeLabel); //Tilfj vagter til dagene p ugen. i0 = mandag, i4 = fredag. for (int i = 0; i < 5; i++) { LocalDateTime date = startTime.plusDays(i); date = date.withField(DateTimeFieldType.hourOfDay(), startHour); date = date.withField(DateTimeFieldType.minuteOfHour(), startMinute); //Nulstil sekunder og millisekunder (vigtigt). date = date.withSecondOfMinute(0); date = date.withMillisOfSecond(0); LocalDateTime endDate = new LocalDateTime(date); endDate = endDate.plusHours(periodLengthHour).plusMinutes(periodLengthMinute); ShiftTile shiftTile = new ShiftTile( Xray.getInstance().getTimeInvestmentControl().getShiftsInPeriod(shifts, date, endDate)); this.getChildren().add(shiftTile); }//w w w.j a v a 2 s . c o m }
From source file:view.schema.AssignedRoomRow.java
public AssignedRoomRow(Room room, ArrayList<TimeInvestment> shifts, LocalDateTime startTime, int startHour, int startMinute, int periodLengthHour, int periodLengthMinute) { this.startTime = startTime; this.room = room; this.shifts = shifts; roomLabel = new RoomTile(room.getRoomName()); //Tilfj rumnavn til venstre. this.getChildren().add(roomLabel); //Tilfj vagter til dagene p ugen. i0 = mandag, i4 = fredag. for (int i = 0; i < 5; i++) { LocalDateTime date = startTime.plusDays(i); date = date.withField(DateTimeFieldType.hourOfDay(), startHour); date = date.withField(DateTimeFieldType.minuteOfHour(), startMinute); //Nulstil sekunder og millisekunder (vigtigt). date = date.withSecondOfMinute(0); date = date.withMillisOfSecond(0); LocalDateTime endDate = new LocalDateTime(date); endDate = endDate.plusHours(periodLengthHour).plusMinutes(periodLengthMinute); ShiftTile shiftTile = new ShiftTile( Xray.getInstance().getTimeInvestmentControl().getShiftsInPeriod(shifts, date, endDate)); this.getChildren().add(shiftTile); }//w ww . j a va 2 s . c o m }