List of usage examples for org.joda.time LocalTime getMillisOfSecond
public int getMillisOfSecond()
From source file:cherry.goods.util.JodaTimeUtil.java
License:Apache License
/** * @param ltm ???{@link LocalTime}/* www.j a va 2 s. c om*/ * @return ?????{@link Calendar}(?)????????(?1970-01-01) */ public static Calendar getCalendar(LocalTime ltm) { Calendar cal = Calendar.getInstance(); cal.set(1970, 0, 1, ltm.getHourOfDay(), ltm.getMinuteOfHour(), ltm.getSecondOfMinute()); cal.set(MILLISECOND, ltm.getMillisOfSecond()); return cal; }
From source file:com.alliander.osgp.domain.core.valueobjects.smartmetering.CosemTime.java
License:Open Source License
public CosemTime(final LocalTime time) { this(time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond() / 10); }
From source file:com.alliander.osgp.dto.valueobjects.smartmetering.CosemTimeDto.java
License:Open Source License
public CosemTimeDto(final LocalTime time) { this(time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond() / 10); }
From source file:com.freewheelschedule.freewheel.api.TriggerBuilder.java
License:Apache License
private String getTriggerTimeFromSource(org.freewheelschedule.freewheel.common.model.Trigger source) { LocalTime triggerTime = ((org.freewheelschedule.freewheel.common.model.TriggerWithTime) source) .getTriggerTime();// www. jav a 2 s . com return triggerTime == null ? null : String.format("%2d:%02d:%02d.%03d", triggerTime.getHourOfDay(), triggerTime.getMinuteOfHour(), triggerTime.getSecondOfMinute(), triggerTime.getMillisOfSecond()); }
From source file:com.helger.datetime.xml.PDTXMLConverter.java
License:Apache License
/** * Get the passed object as {@link XMLGregorianCalendar} time (without a * date)./* w w w. ja v a 2 s . c o m*/ * * @param aBase * The source object. May be <code>null</code>. * @return <code>null</code> if the parameter is <code>null</code>. */ @Nullable public static XMLGregorianCalendar getXMLCalendarTime(@Nullable final LocalTime aBase) { return aBase == null ? null : s_aDTFactory.newXMLGregorianCalendarTime(aBase.getHourOfDay(), aBase.getMinuteOfHour(), aBase.getSecondOfMinute(), aBase.getMillisOfSecond(), DatatypeConstants.FIELD_UNDEFINED); }
From source file:com.sandata.lab.common.utils.date.DateUtil.java
License:Open Source License
public static Date combineDateAndTime(Date date, LocalTime time) { return new LocalDateTime(date.getTime()).withHourOfDay(time.getHourOfDay()) .withMinuteOfHour(time.getMinuteOfHour()).withSecondOfMinute(time.getSecondOfMinute()) .withMillisOfSecond(time.getMillisOfSecond()).toDate(); }
From source file:de.jpaw.bonaparte.util.DayTime.java
License:Apache License
/** Converts the time portion of a LocalTime or localDateTime into a number in the format HHMMSSMMM. */ static public int timeAsInt(LocalTime when) { return when.getMillisOfSecond() + 1000 * when.getSecondOfMinute() + 100000 * when.getMinuteOfHour() + 10000000 * when.getHourOfDay(); }
From source file:divconq.util.TimeUtil.java
License:Open Source License
/** * try to supply a time for a date, if it fails it may be because of DST and that time (hour) is skipped on that date. * So try again to supply a time +1 hour to see if it helps. * // w w w . j av a 2s. c om * @param d date to set time into * @param t time to set to * @return datetime with the supplied time (maybe +1 hour) or null */ static public DateTime withTime(DateTime d, LocalTime t) { try { return d.withTime(t.getHourOfDay(), t.getMinuteOfHour(), t.getSecondOfMinute(), t.getMillisOfSecond()); } catch (Exception x) { // TODO hour +1 is a hack, should work in USA/Canada - and probably lots of places - but maybe not everywhere if (TimeUtil.checkDST(d) == DaylightTransition.START) return d.withTime(t.getHourOfDay() + 1, t.getMinuteOfHour(), t.getSecondOfMinute(), t.getMillisOfSecond()); } return null; }
From source file:energy.usef.core.util.DateTimeUtil.java
License:Apache License
/** * This method gets the current DateTime, but updates the time given as a paramater. * * @param time - The time to be set.//from w ww. j a va 2 s . c o m * @return An update LocalDateTime with the current Date and the requested time. */ public static LocalDateTime getCurrentDateWithTime(LocalTime time) { return DateTimeUtil.getTime().withTime(time.getHourOfDay(), time.getMinuteOfHour(), time.getSecondOfMinute(), time.getMillisOfSecond()); }
From source file:io.datenwelt.cargo.rest.serialization.LocalTimeSerializer.java
License:Apache License
@Override public void serialize(LocalTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { String str;// ww w . jav a2s. c om if (value.getMillisOfSecond() == 0) { str = FORMAT.print(value); } else { str = FORMAT_MILLIS.print(value); } gen.writeString(str); }