List of usage examples for org.joda.time LocalTime MIDNIGHT
LocalTime MIDNIGHT
To view the source code for org.joda.time LocalTime MIDNIGHT.
Click Source Link
From source file:ch.eitchnet.android.mabea.model.MabeaContext.java
License:Open Source License
public Today getToday() { if (this.today == null) { MabeaState state = getConnection().getMabeaState(); LocalDateTime midnight = LocalDate.now().toLocalDateTime(LocalTime.MIDNIGHT); Booking initialBooking = new Booking(State.LOGGED_OUT, midnight, state.getBalance()); this.today = new Today(this.setting.getRequiredWorkPerDay(), initialBooking); }// ww w . ja va 2 s.c o m return this.today; }
From source file:ch.eitchnet.android.mabea.model.Today.java
License:Open Source License
/** * Default constructor/* ww w . j av a 2 s . c o m*/ * * @param requiredWorkPerDay * @param initialBooking */ public Today(Duration requiredWorkPerDay, Booking initialBooking) { if (requiredWorkPerDay == null) throw new IllegalArgumentException("requiredWorkPerDay must not be null"); if (initialBooking == null) throw new IllegalArgumentException("Initial booking must not be null!"); if (initialBooking.getState() != State.LOGGED_OUT) throw new IllegalArgumentException( "Initial booking must be " + MabeaState.State.LOGGED_OUT + " not " + initialBooking.getState()); if (initialBooking.getTimestamp().compareTo(LocalDate.now().toLocalDateTime(LocalTime.MIDNIGHT)) > 0) throw new IllegalArgumentException("The initial booking must be at midnight of today!"); this.dateCreated = LocalDate.now(); this.requiredWorkPerDay = requiredWorkPerDay; this.startBalance = initialBooking.getBalance(); this.workToday = new Duration(0L); this.bookings = new ArrayList<Booking>(); this.bookings.add(initialBooking); }
From source file:cherry.goods.util.LocalDateTimeUtil.java
License:Apache License
/** * (FROM)???//from w ww. ja va2 s . c o m * * @param from ?? * @return ????(FROM)?? */ public static LocalDateTime rangeFrom(LocalDate from) { if (from == null) { return null; } return from.toLocalDateTime(LocalTime.MIDNIGHT); }
From source file:cherry.goods.util.LocalDateTimeUtil.java
License:Apache License
/** * (FROM)???/*from w w w. jav a2s .co m*/ * * @param fromD ?? * @param fromT ?? * @return ?????(FROM)?? */ public static LocalDateTime rangeFrom(LocalDate fromD, LocalTime fromT) { if (fromD == null) { return null; } if (fromT == null) { return fromD.toLocalDateTime(LocalTime.MIDNIGHT); } return fromD.toLocalDateTime(fromT); }
From source file:cherry.goods.util.LocalDateTimeUtil.java
License:Apache License
/** * (TO)???/*from w ww .j a v a2 s . c o m*/ * * @param to ?? * @return ????(TO)?? */ public static LocalDateTime rangeTo(LocalDate to) { if (to == null) { return null; } return to.toLocalDateTime(LocalTime.MIDNIGHT).plusDays(1); }
From source file:cherry.goods.util.LocalDateTimeUtil.java
License:Apache License
/** * (TO)???/*from w w w . ja v a 2 s. c o m*/ * * @param toD ?? * @param toT ?? * @return ?????(TO)?? */ public static LocalDateTime rangeTo(LocalDate toD, LocalTime toT) { if (toD == null) { return null; } if (toT == null) { return toD.toLocalDateTime(LocalTime.MIDNIGHT).plusDays(1); } return toD.toLocalDateTime(toT).plus(unitOfTime); }
From source file:com.hangum.tadpold.commons.libs.core.sqls.ParameterUtils.java
License:Open Source License
/** * original code is http://www.gotoquiz.com/web-coding/programming/java-programming/log-sql-statements-with-parameter-values-filled-in-spring-jdbc/ * //from ww w. j a va 2 s . c o m * @param statement * @param sqlArgs * @return */ public static String fillParameters(String statement, Object[] sqlArgs) { // initialize a StringBuilder with a guesstimated final length StringBuilder completedSqlBuilder = new StringBuilder(Math.round(statement.length() * 1.2f)); int index, // will hold the index of the next ? prevIndex = 0; // will hold the index of the previous ? + 1 // loop through each SQL argument for (Object arg : sqlArgs) { index = statement.indexOf("?", prevIndex); if (index == -1) break; // bail out if there's a mismatch in # of args vs. ?'s // append the chunk of SQL coming before this ? completedSqlBuilder.append(statement.substring(prevIndex, index)); if (arg == null) completedSqlBuilder.append("NULL"); else if (arg instanceof String) { // wrap the String in quotes and escape any quotes within completedSqlBuilder.append('\'').append(arg.toString().replace("'", "''")).append('\''); } else if (arg instanceof Date) { // convert it to a Joda DateTime DateTime dateTime = new DateTime((Date) arg); // test to see if it's a DATE or a TIMESTAMP if (dateTime.getHourOfDay() == LocalTime.MIDNIGHT.getHourOfDay() && dateTime.getMinuteOfHour() == LocalTime.MIDNIGHT.getMinuteOfHour() && dateTime.getSecondOfMinute() == LocalTime.MIDNIGHT.getSecondOfMinute()) { completedSqlBuilder.append("DATE '").append(DATE_FORMATTER.print(dateTime)).append('\''); } else { completedSqlBuilder.append("TIMESTAMP '").append(TIMESTAMP_FORMATTER.print(dateTime)) .append('\''); } } else completedSqlBuilder.append(arg.toString()); prevIndex = index + 1; } // add the rest of the SQL if any if (prevIndex != statement.length()) completedSqlBuilder.append(statement.substring(prevIndex)); return completedSqlBuilder.toString(); }
From source file:com.pureblue.quant.signal.technical.AverageDailyMovement.java
/** * Constructs an instance to track the average daily movement over a fixed length window, with * the start time of a day defined as midnight (that is, 00:00). * * @param size the size of the moving window *///from w ww . j a v a2 s . c o m public AverageDailyMovement(int size) { this(new LocalTime(LocalTime.MIDNIGHT), size); }
From source file:com.pureblue.quant.util.frequency.Daily.java
/** * Constructs a new instance where a day is defined to start at midnight. */ public Daily() { this(LocalTime.MIDNIGHT); }
From source file:com.pureblue.quant.util.frequency.Weekly.java
/** * Constructs a weekly frequency where the week starts on at midnight on Monday. */ public Weekly() { this(DayOfWeek.MONDAY, LocalTime.MIDNIGHT); }