List of usage examples for org.joda.time DateTime getMinuteOfHour
public int getMinuteOfHour()
From source file:julian.lylly.model.Util.java
public static String dateTimeToString(DateTime dt) { String y = dt.getYear() + ""; String m = longTo2DigitString(dt.getMonthOfYear()); String d = longTo2DigitString(dt.getDayOfMonth()); String h = longTo2DigitString(dt.getHourOfDay()); String mi = longTo2DigitString(dt.getMinuteOfHour()); return y + "-" + m + "-" + d + " " + h + ":" + mi; }
From source file:kr.debop4j.timeperiod.TimeCalendar.java
License:Apache License
@Override public int getMinuteOfHour(DateTime time) { return time.getMinuteOfHour(); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** * Sets hour.// w ww . j a v a 2s. co m * * @param moment the moment * @param hourOfDay the hour of day * @return the hour */ public static DateTime setHour(DateTime moment, int hourOfDay) { return setTime(moment, hourOfDay, moment.getMinuteOfHour(), moment.getSecondOfMinute(), moment.getMillisOfSecond()); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** * Sets second./*from w w w . ja v a 2 s . c o m*/ * * @param moment the moment * @param secondOfMinute the second of minute * @return the second */ public static DateTime setSecond(DateTime moment, int secondOfMinute) { return setTime(moment, moment.getHourOfDay(), moment.getMinuteOfHour(), secondOfMinute, moment.getMillisOfSecond()); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** * Sets millisecond.//from w w w . j a va 2 s . c om * * @param moment the moment * @param millisOfSecond the millis of second * @return the millisecond */ public static DateTime setMillisecond(DateTime moment, int millisOfSecond) { return setTime(moment, moment.getHourOfDay(), moment.getMinuteOfHour(), moment.getSecondOfMinute(), millisOfSecond); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** * Trim to second.//w w w . ja va 2 s . c o m * * @param moment the moment * @param secondOfMinute the second of minute * @return the date time */ public static DateTime trimToSecond(DateTime moment, int secondOfMinute) { return trimToMinute(moment, moment.getMinuteOfHour()).withSecondOfMinute(secondOfMinute); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** ? (Minute) . */ public static List<ITimePeriod> foreachMinutes(ITimePeriod period) { shouldNotBeNull(period, "period"); if (isTraceEnabled) log.trace("[{}]? (Minute) ...", period); List<ITimePeriod> minutes = Lists.newArrayList(); if (period.isAnytime()) return minutes; assertHasPeriod(period);/*from ww w . jav a 2s. c o m*/ if (Times.isSameMinute(period.getStart(), period.getEnd())) { minutes.add(new TimeRange(period)); return minutes; } minutes.add(new TimeRange(period.getStart(), Times.endTimeOfMinute(period.getStart()))); DateTime endMinute = period.getEnd(); DateTime current = Times.trimToMinute(period.getStart(), period.getStart().getMinuteOfHour() + 1); ITimeCalendar calendar = TimeCalendar.getDefault(); DateTime maxMinute = endMinute.minusMinutes(1); while (current.compareTo(maxMinute) <= 0) { minutes.add(Times.getMinuteRange(current, calendar)); current = current.plusMinutes(1); } if (endMinute.minusMinutes(endMinute.getMinuteOfHour()).getMillisOfDay() > 0) { minutes.add(new TimeRange(Times.startTimeOfMinute(endMinute), endMinute)); } return minutes; }
From source file:li.klass.fhem.adapter.devices.core.generic.detail.actions.devices.fht.HolidayShort.java
License:Open Source License
int extractHolidayShortHoliday1ValueFrom(DateTime dateTime) { return calculateHolidayShortHoliday1ValueFrom(dateTime.getHourOfDay(), dateTime.getMinuteOfHour()); }
From source file:li.klass.fhem.adapter.devices.core.generic.detail.actions.devices.fht.HolidayShort.java
License:Open Source License
boolean holidayShortIsTomorrow(DateTime switchTime, DateTime baseline) { int currentMinute = baseline.getHourOfDay() * 60 + baseline.getMinuteOfHour(); int switchMinute = switchTime.getHourOfDay() * 60 + switchTime.getMinuteOfHour(); return switchMinute < currentMinute; }
From source file:li.klass.fhem.domain.AtDevice.java
License:Open Source License
private void parseDateContent(String dateContent) { if (dateContent.length() < "00:00:00".length()) { dateContent += ":00"; }// w ww. j av a2 s .com try { DateTime date = DATE_TIME_FORMAT.parseDateTime(dateContent); hours = date.getHourOfDay(); minutes = date.getMinuteOfHour(); seconds = date.getSecondOfMinute(); } catch (Exception e) { Log.e(AtDevice.class.getName(), "cannot parse dateContent " + dateContent); } }