/** * Returns a copy of this datetime with the specified date, retaining the time fields. * <p> * If the date is already the date passed in, then <code>this</code> is returned. * <p> * To set a single field use the properties, for example: * <pre> * DateTime set = monthOfYear().setCopy(6); * </pre> * <p> * If the time is invalid on the new date due to the time-zone, the time will be adjusted. * <p> * This instance is immutable and unaffected by this method call. * * @param year the new year value * @param monthOfYear the new monthOfYear value * @param dayOfMonth the new dayOfMonth value * @return a copy of this datetime with a different date * @throws IllegalArgumentException if any value if invalid */ public DateTime withDate(int year, int monthOfYear, int dayOfMonth) { Chronology chrono = getChronology(); long localInstant = chrono.withUTC().getDateTimeMillis(year, monthOfYear, dayOfMonth, getMillisOfDay()); return withMillis(chrono.getZone().convertLocalToUTC(localInstant, false, getMillis())); }
/** * Returns a copy of this datetime with the specified date, retaining the time fields. * <p> * If the date is already the date passed in, then <code>this</code> is returned. * <p> * To set a single field use the properties, for example: * <pre> * DateTime set = monthOfYear().setCopy(6); * </pre> * <p> * If the time is invalid on the new date due to the time-zone, the time will be adjusted. * <p> * This instance is immutable and unaffected by this method call. * * @param year the new year value * @param monthOfYear the new monthOfYear value * @param dayOfMonth the new dayOfMonth value * @return a copy of this datetime with a different date * @throws IllegalArgumentException if any value if invalid */ public DateTime withDate(int year, int monthOfYear, int dayOfMonth) { Chronology chrono = getChronology(); long localInstant = chrono.withUTC().getDateTimeMillis(year, monthOfYear, dayOfMonth, getMillisOfDay()); return withMillis(chrono.getZone().convertLocalToUTC(localInstant, false, getMillis())); }
if(dateTime.getMillisOfDay() != 0) { handleOutOfRangeValue(pigObj, hcatFS, "Time component must be 0 (midnight) in local timezone; Local TZ val='" + pigObj + "'"); return null;
public long milliSecondsSinceMidnight() { return time.getMillisOfDay(); }
public long milliSecondsSinceMidnight() { return time.getMillisOfDay(); }
/** * The number of seconds since midnight. */ @Deprecated public long longValue() { return time.getMillisOfDay() / 1000; }
/** * The number of seconds since midnight. */ @Deprecated public long longValue() { return time.getMillisOfDay() / 1000; }
@SuppressWarnings("unchecked") public static String newEditKey(HttpSession sess){ int mills = new DateTime().getMillisOfDay(); Map<String,EditConfigurationVTwo> configs = (Map<String,EditConfigurationVTwo>)sess.getAttribute("EditConfigurations"); if( configs == null ){ return Integer.toString(mills); }else{ while( configs.containsKey( Integer.toString(mills) )){ mills ++; } return Integer.toString(mills); } }
/** * Return {@code true} of this {@link Timestamp} does not have relevant * temporal componet. * * @return {@code true} if this {@link Timestamp} represents a date */ public boolean isDateOnly() { DateTime joda = getJoda(); return joda.getMillisOfDay() == 0; }
DateTime currentTime = new DateTime(); DateTime dateResult; boolean shouldReturnLastMonday = (currentTime.getDayOfWeek() != DateTimeConstants.MONDAY || currentTime.hourOfDay().get() < 2); if (shouldReturnLastMonday) { dateResult = currentTime.minus(Days.days(currentTime.getDayOfWeek() - DateTimeConstants.MONDAY)) .minus(currentTime.getMillisOfDay()) .plus(Hours.hours(2)); } else { dateResult = currentTime.minus(currentTime.getMillisOfDay()) .plus(Hours.hours(2)); } System.out.println(dateResult);
/** * Get todays events. A convenience method for easy testing * * @param calendarId * @return * @throws Exception */ public ArrayNode getEventsToday(@Optional @Name("calendarId") String calendarId) throws Exception { DateTime now = DateTime.now(); DateTime timeMin = now.minusMillis(now.getMillisOfDay()); DateTime timeMax = timeMin.plusDays(1); return getEvents(timeMin.toString(), timeMax.toString(), calendarId); }
/** * Populate the MDEntry given group with the given date time value. * * @param inGroup a <code>Group</code> value * @param inDateTime a <code>DateTime</code> value */ public void populateMdEntryGroupWithDateTime(Group inGroup, DateTime inDateTime) { if(inDateTime == null) { return; } // TODO the time doesn't seem quite right inGroup.setField(new quickfix.field.MDEntryDate(inDateTime.minusMillis(inDateTime.getMillisOfDay()).toDate())); inGroup.setField(new quickfix.field.MDEntryTime(inDateTime.minusYears(inDateTime.getYear()).minusDays(inDateTime.getDayOfYear()).toDate())); } /**
/** * Get busy intervals of today. A convenience method for easy testing * * @param calendarId * optional calendar id. If not provided, the default calendar is * used * @param timeZone * Time zone used in the response. Optional. The default is UTC. * * @return * @throws Exception */ public ArrayNode getBusyToday(@Optional @Name("calendarId") String calendarId, @Optional @Name("timeZone") String timeZone) throws Exception { DateTime now = DateTime.now(); DateTime timeMin = now.minusMillis(now.getMillisOfDay()); DateTime timeMax = timeMin.plusDays(1); return getBusy(timeMin.toString(), timeMax.toString(), calendarId, timeZone); }
if (dateTime == null) dateTime = hours; else { dateTime = dateTime.withMillisOfDay(hours.getMillisOfDay()).withZone(hours.getZone());
/** * Returns a copy of this datetime with the specified date, retaining the time fields. * <p> * If the date is already the date passed in, then <code>this</code> is returned. * <p> * To set a single field use the properties, for example: * <pre> * DateTime set = monthOfYear().setCopy(6); * </pre> * <p> * If the time is invalid on the new date due to the time-zone, the time will be adjusted. * <p> * This instance is immutable and unaffected by this method call. * * @param year the new year value * @param monthOfYear the new monthOfYear value * @param dayOfMonth the new dayOfMonth value * @return a copy of this datetime with a different date * @throws IllegalArgumentException if any value if invalid */ public DateTime withDate(int year, int monthOfYear, int dayOfMonth) { Chronology chrono = getChronology(); long localInstant = chrono.withUTC().getDateTimeMillis(year, monthOfYear, dayOfMonth, getMillisOfDay()); return withMillis(chrono.getZone().convertLocalToUTC(localInstant, false, getMillis())); }
/** * Returns a copy of this datetime with the specified date, retaining the time fields. * <p> * If the date is already the date passed in, then <code>this</code> is returned. * <p> * To set a single field use the properties, for example: * <pre> * DateTime set = monthOfYear().setCopy(6); * </pre> * <p> * If the time is invalid on the new date due to the time-zone, the time will be adjusted. * <p> * This instance is immutable and unaffected by this method call. * * @param year the new year value * @param monthOfYear the new monthOfYear value * @param dayOfMonth the new dayOfMonth value * @return a copy of this datetime with a different date * @throws IllegalArgumentException if any value if invalid */ public DateTime withDate(int year, int monthOfYear, int dayOfMonth) { Chronology chrono = getChronology(); long localInstant = chrono.withUTC().getDateTimeMillis(year, monthOfYear, dayOfMonth, getMillisOfDay()); return withMillis(chrono.getZone().convertLocalToUTC(localInstant, false, getMillis())); }
if(dateTime.getMillisOfDay() != 0) { handleOutOfRangeValue(pigObj, hcatFS, "Time component must be 0 (midnight) in local timezone; Local TZ val='" + pigObj + "'"); return null;
if(dateTime.getMillisOfDay() != 0) { handleOutOfRangeValue(pigObj, hcatFS, "Time component must be 0 (midnight) in local timezone; Local TZ val='" + pigObj + "'"); return null;
valueMap.put(HistoDbMetaAttributeId.daytime, n.getCaseDate().getMillisOfDay());