List of usage examples for org.joda.time LocalTime toDateTimeToday
public DateTime toDateTimeToday()
From source file:com.mysema.query.sql.types.LocalTimeType.java
License:Apache License
@Override public void setValue(PreparedStatement st, int startIndex, LocalTime value) throws SQLException { st.setTime(startIndex, new Time(value.toDateTimeToday().getMillis())); }
From source file:de.hh.changeRing.infrastructure.eclipselink.JodaLocalTimeConverter.java
License:Open Source License
@Override public java.util.Date toDatabaseLayerType(org.joda.time.LocalTime objectValue) { return objectValue.toDateTimeToday().withYear(1970).withMonthOfYear(1).withDayOfMonth(1).toDate(); }
From source file:dk.teachus.backend.domain.impl.PeriodImpl.java
License:Apache License
public boolean isTimeValid(LocalTime time) { boolean timeValid = false; Interval periodTimeInterval = new Interval(startTime.toDateTimeToday(), endTime.toDateTimeToday()); if (periodTimeInterval.contains(time.toDateTimeToday())) { int timeMinutes = new Duration(startTime.toDateTimeToday(), time.toDateTimeToday()) .toPeriod(PeriodType.minutes()).getMinutes(); if (timeMinutes % intervalBetweenLessonStart == 0) { timeValid = true;/*from w ww . j a va2s. co m*/ } } return timeValid; }
From source file:es.usc.citius.servando.calendula.activities.ReminderNotification.java
License:Open Source License
public static void notify(final Context context, final String title, Schedule schedule, LocalDate date, LocalTime time, Intent intent, boolean lost) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); boolean notifications = prefs.getBoolean("alarm_notifications", true); if (!notifications) { return;/*from w w w. j a v a 2s .c om*/ } NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); style.setBigContentTitle(title); styleForSchedule(context, style, schedule, lost); Pair<Intent, Intent> intents = lost ? null : getIntentsForSchedule(context, schedule, date, time); NotificationOptions options = new NotificationOptions(); options.style = style; options.lost = lost; options.when = time.toDateTimeToday().getMillis(); options.tag = NOTIFICATION_SCHEDULE_TAG; options.notificationNumber = 1; options.picture = getLargeIcon(context.getResources(), schedule.patient()); options.text = schedule.medicine().name() + " (" + schedule.toReadableString(context) + ")"; notify(context, scheduleNotificationId(schedule.getId().intValue()), title, intents, intent, options); }
From source file:io.github.benas.randombeans.randomizers.jodatime.range.JodaTimeLocalTimeRangeRandomizer.java
License:Open Source License
/** * Create a new {@link JodaTimeLocalTimeRangeRandomizer}. * @param min date//from www . j a v a2 s . c o m * @param max date * @param seed initial seed */ public JodaTimeLocalTimeRangeRandomizer(final LocalTime min, final LocalTime max, final long seed) { super(min.toDateTimeToday().toDate(), max.toDateTimeToday().toDate(), seed); }
From source file:io.kahu.hawaii.util.xml.bind.DateTimeConverter.java
License:Apache License
public static String printTime(LocalTime input) { Calendar cal = Calendar.getInstance(); cal.setTime(input.toDateTimeToday().toDate()); return DatatypeConverter.printTime(cal); }
From source file:net.sargue.base.util.JodaUtils.java
License:Open Source License
/** * Convierte la hora en el formato de Joda-Time al equivalente en el formato de de JDBC * java.sql.Time/* w w w. ja v a 2 s. c o m*/ * * @param hora la fecha en formato Joda-Time * @return la misma hora en formato JDBC */ public static Time toJDBC(LocalTime hora) { return hora == null ? null : new Time(hora.toDateTimeToday().getMillis()); }
From source file:org.agatom.springatom.data.hades.model.appointment.NAppointment.java
License:Open Source License
public NAppointment setBeginTime(final LocalTime localTime) { this.requireBeginDate(); final MutableDateTime mutableDateTime = this.begin.toMutableDateTime(); mutableDateTime.setTime(localTime.toDateTimeToday()); this.begin = mutableDateTime.toDateTime(); return this; }
From source file:org.agatom.springatom.data.hades.model.appointment.NAppointment.java
License:Open Source License
public NAppointment setEndTime(final LocalTime localTime) { this.requireEndDate(); final MutableDateTime mutableDateTime = this.end.toMutableDateTime(); mutableDateTime.setTime(localTime.toDateTimeToday()); this.end = mutableDateTime.toDateTime(); return this; }
From source file:org.apache.sqoop.connector.hbase.HbaseExecutor.java
License:Apache License
public void addBatch(Object[] array, Schema schema) { try {//ww w .j a va2 s. c o m Column[] schemaColumns = schema.getColumnsArray(); for (int i = 0; i < array.length; i++) { Column schemaColumn = schemaColumns[i]; switch (schemaColumn.getType()) { case DATE: // convert the JODA date to sql date LocalDate date = (LocalDate) array[i]; java.sql.Date sqlDate = new java.sql.Date(date.toDateTimeAtCurrentTime().getMillis()); preparedStatement.setObject(i + 1, sqlDate); break; case DATE_TIME: // convert the JODA date time to sql date DateTime dateTime = (DateTime) array[i]; Timestamp timestamp = new Timestamp(dateTime.getMillis()); preparedStatement.setObject(i + 1, timestamp); break; case TIME: // convert the JODA time to sql date LocalTime time = (LocalTime) array[i]; java.sql.Time sqlTime = new java.sql.Time(time.toDateTimeToday().getMillis()); preparedStatement.setObject(i + 1, sqlTime); break; default: // for anything else preparedStatement.setObject(i + 1, array[i]); } } preparedStatement.addBatch(); } catch (SQLException e) { logSQLException(e); throw new SqoopException(GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0002, e); } }