List of usage examples for org.joda.time DateTime getMillisOfDay
public int getMillisOfDay()
From source file:com.sos.scheduler.model.objects.JodaTools.java
License:Apache License
public static DateTime getStartOfMonth(DateTime base) { return base.minusMillis(base.getMillisOfDay()).minusDays(base.getDayOfMonth() - 1); }
From source file:com.sos.scheduler.model.objects.JodaTools.java
License:Apache License
public static DateTime getStartOfDay(DateTime base) { return base.minusMillis(base.getMillisOfDay()); }
From source file:com.vaushell.superpipes.nodes.buffer.Slot.java
License:Open Source License
/** * Are we inside this slot ?//from w w w. ja v a2s . co m * * @param date Actual date * @return true or not */ boolean areWeInside(final DateTime date) { if (!daysOfWeek.contains(date.getDayOfWeek())) { return false; } final int dayMS = date.getMillisOfDay(); return minMillisOfDay <= dayMS && dayMS < maxMillisOfDay; }
From source file:de.kuschku.libquassel.primitives.serializers.DateTimeSerializer.java
License:Open Source License
@Override public void serialize(@NonNull final ByteChannel channel, @NonNull final DateTime data) throws IOException { final boolean isUTC; final DateTimeZone zone = data.getZone(); if (Objects.equals(zone, DateTimeZone.UTC)) { isUTC = true;/* w ww.ja v a 2s . c om*/ } else if (Objects.equals(zone, DateTimeZone.getDefault())) { isUTC = false; // TODO: Add serialization for other timezones } else { throw new IllegalArgumentException( "Serialization of timezones except for local and UTC is not supported"); } IntSerializer.get().serialize(channel, (int) DateTimeUtils.toJulianDayNumber(data.getMillis())); IntSerializer.get().serialize(channel, data.getMillisOfDay()); BoolSerializer.get().serialize(channel, isUTC); }
From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration.java
License:Open Source License
public static String newEditKey(HttpSession sess) { DateTime time = new DateTime(); int mills = time.getMillisOfDay(); Map<String, EditConfiguration> configs = (Map<String, EditConfiguration>) sess .getAttribute("EditConfigurations"); if (configs == null) { return Integer.toString(mills); } else {//w w w. j av a 2s . co m while (configs.containsKey(Integer.toString(mills))) { mills++; } return Integer.toString(mills); } }
From source file:google.registry.model.common.TimeOfYear.java
License:Open Source License
/** * Constructs a {@link TimeOfYear} from a {@link DateTime}. * * <p>This handles leap years in an intentionally peculiar way by always treating February 29 as * February 28. It is impossible to construct a {@link TimeOfYear} for February 29th. *///from w w w. j ava 2 s.co m public static TimeOfYear fromDateTime(DateTime dateTime) { DateTime nextYear = dateTime.plusYears(1); // This turns February 29 into February 28. TimeOfYear instance = new TimeOfYear(); instance.timeString = String.format("%02d %02d %08d", nextYear.getMonthOfYear(), nextYear.getDayOfMonth(), nextYear.getMillisOfDay()); return instance; }
From source file:ips1ap101.lib.base.util.StrUtils.java
License:Open Source License
public static String getString(Object obj) { if (obj == null) { return null; } else if (obj instanceof Date) { return TimeUtils.defaultDateString(obj); } else if (obj instanceof Time) { return TimeUtils.defaultTimeString(obj); } else if (obj instanceof java.util.Date) { DateTime datetime = new DateTime(obj); return datetime.getMillisOfDay() == 0 ? TimeUtils.defaultDateString(obj) : TimeUtils.defaultTimestampString(obj); } else {/*from w w w .ja v a 2 s .c o m*/ return String.valueOf(obj); } }
From source file:kr.debop4j.timeperiod.Timepart.java
License:Apache License
/** * Instantiates a new Timepart./*from w w w . j av a 2 s. c om*/ * * @param moment the moment */ public Timepart(DateTime moment) { this.timepart = new DateTime(0).withMillisOfDay(moment.getMillisOfDay()); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** ??? ? . */ public static Duration getTime(DateTime moment) { return new Duration(moment.getMillisOfDay()); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** ?? ? ? */ public static boolean hasTime(DateTime moment) { return moment.getMillisOfDay() > 0; }