/** * Converts this LocalDate to a full datetime using the default time zone * setting the date fields from this instance and the time fields from * the current time. * <p> * This method will throw an exception if the datetime that would be * created does not exist when the time zone is taken into account. * <p> * This instance is immutable and unaffected by this method call. * * @return this date as a datetime with the time as the current time */ public DateTime toDateTimeAtCurrentTime() { return toDateTimeAtCurrentTime(null); }
/** * Converts this LocalDate to a full datetime using the default time zone * setting the date fields from this instance and the time fields from * the current time. * <p> * This method will throw an exception if the datetime that would be * created does not exist when the time zone is taken into account. * <p> * This instance is immutable and unaffected by this method call. * * @return this date as a datetime with the time as the current time */ public DateTime toDateTimeAtCurrentTime() { return toDateTimeAtCurrentTime(null); }
String formatted = (String) formattingService.convert(new LocalDate(2009, 10, 31).toDateTimeAtCurrentTime() .toDate(), new TypeDescriptor(modelClass.getField("date")), TypeDescriptor.valueOf(String.class)); assertEquals("10/31/09", formatted); dates.add(new LocalDate(2009, 10, 31).toDateTimeAtCurrentTime().toDate()); dates.add(new LocalDate(2009, 11, 1).toDateTimeAtCurrentTime().toDate()); dates.add(new LocalDate(2009, 11, 2).toDateTimeAtCurrentTime().toDate()); formatted = (String) formattingService.convert(dates, new TypeDescriptor(modelClass.getField("dates")), TypeDescriptor.valueOf(String.class));
return toDateTimeAtCurrentTime(zone);
return toDateTimeAtCurrentTime(zone);
/** * Converts this LocalDate to a full datetime using the default time zone * setting the date fields from this instance and the time fields from * the current time. * <p> * This method will throw an exception if the datetime that would be * created does not exist when the time zone is taken into account. * <p> * This instance is immutable and unaffected by this method call. * * @return this date as a datetime with the time as the current time */ public DateTime toDateTimeAtCurrentTime() { return toDateTimeAtCurrentTime(null); }
/** * Converts this LocalDate to a full datetime using the default time zone * setting the date fields from this instance and the time fields from * the current time. * <p> * This method will throw an exception if the datetime that would be * created does not exist when the time zone is taken into account. * <p> * This instance is immutable and unaffected by this method call. * * @return this date as a datetime with the time as the current time */ public DateTime toDateTimeAtCurrentTime() { return toDateTimeAtCurrentTime(null); }
/** * Converts this LocalDate to a full datetime using the default time zone * setting the date fields from this instance and the time fields from * the current time. * <p> * This method will throw an exception if the datetime that would be * created does not exist when the time zone is taken into account. * <p> * This instance is immutable and unaffected by this method call. * * @return this date as a datetime with the time as the current time */ public DateTime toDateTimeAtCurrentTime() { return toDateTimeAtCurrentTime(null); }
/** * Converts this LocalDate to a full datetime using the default time zone * setting the date fields from this instance and the time fields from * the current time. * <p> * This method will throw an exception if the datetime that would be * created does not exist when the time zone is taken into account. * <p> * This instance is immutable and unaffected by this method call. * * @return this date as a datetime with the time as the current time */ public DateTime toDateTimeAtCurrentTime() { return toDateTimeAtCurrentTime(null); }
/** * Converts this LocalDate to a full datetime using the default time zone * setting the date fields from this instance and the time fields from * the current time. * <p> * This method will throw an exception if the datetime that would be * created does not exist when the time zone is taken into account. * <p> * This instance is immutable and unaffected by this method call. * * @return this date as a datetime with the time as the current time */ public DateTime toDateTimeAtCurrentTime() { return toDateTimeAtCurrentTime(null); }
import org.joda.time.LocalDate; ... LocalDate startDate= new LocalDate();//"2014-05-06T10:59:45.618-06:00"); //or DateTime startDate = new DateTime ();// creates instance of current time String formatted = startDate.toDateTimeAtCurrentTime().toString("MM/dd/yyy HH:mm:ss");
public InvoiceModelDao(final UUID accountId, final LocalDate invoiceDate, final Currency currency, final InvoiceStatus status, final boolean isParentInvoice) { this(UUIDs.randomUUID(), invoiceDate.toDateTimeAtCurrentTime(), accountId, null, invoiceDate, null, currency, false, status, isParentInvoice); }
static public ExecutionYear readByDateTime(final LocalDate localDate) { return executionYearSearchCache.findByDateTime(localDate.toDateTimeAtCurrentTime()); }
private PhdCandidacyPeriod getPhdCandidacyPeriod(final PhdProgramPublicCandidacyHashCode hashCode) { final DateTime date = (hashCode != null && hashCode.hasCandidacyProcess()) ? hashCode.getPhdProgramCandidacyProcess() .getCandidacyDate().toDateTimeAtCurrentTime() : new DateTime(); return InstitutionPhdCandidacyPeriod.readInstitutionPhdCandidacyPeriodForDate(date); }
private DateTime getMostAccurateDiscussionDateTime() { if (getProcessBean().getSecondDiscussionDate() != null) { return getProcessBean().getSecondDiscussionDate().toDateTimeAtCurrentTime(); } else if (getProcessBean().getFirstDiscussionDate() != null) { return getProcessBean().getFirstDiscussionDate().toDateTimeAtCurrentTime(); } return null; }
private DateTime getMeetingDate() { if (getProcessBean().getMeetingDate() != null) { return getProcessBean().getMeetingDate().toDateTimeAtCurrentTime(); } else { return null; } }
@Test public void should_find_entries_in_range_for_users() { Interval i = new Interval(new LocalDate(2007, DateTimeConstants.JANUARY, 1).toDateTimeAtCurrentTime(), new LocalDate(2007, DateTimeConstants.JANUARY, 30).toDateTimeAtCurrentTime()); List<TimesheetComment> comments = timesheetCommentDao.findCommentBetweenForUsers(Lists.newArrayList(2, 3), new DateRange(i)); assertEquals(2, comments.get(0).getCommentId().getUserId().intValue()); assertEquals(3, comments.get(1).getCommentId().getUserId().intValue()); } }
@Test public void should_find_entries_in_range() { Interval i = new Interval(new LocalDate(2007, DateTimeConstants.JANUARY, 13).toDateTimeAtCurrentTime(), new LocalDate(2007, DateTimeConstants.JANUARY, 22).toDateTimeAtCurrentTime()); List<TimesheetComment> comments = timesheetCommentDao.findCommentBetween(new DateRange(i)); assertEquals(2, comments.size()); assertThat(comments.get(0).getCommentId().getCommentDate().toString(), startsWith("2007-01-14")); assertThat(comments.get(1).getCommentId().getCommentDate().toString(), startsWith("2007-01-21")); }
private void setFifthParagraph() { String fifthParagraph; if (getUniversity(new DateTime()) != getUniversity(getDocumentRequest().getConclusionDate().toDateTimeAtCurrentTime())) { fifthParagraph = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.phd.registryDiploma.fifthParagraph.UTL.UL"); } else { fifthParagraph = BundleUtil.getString(Bundle.ACADEMIC, getLocale(), "label.phd.registryDiploma.fifthParagraph"); } addParameter("fifthParagraph", MessageFormat.format(fifthParagraph, BundleUtil.getString(Bundle.ENUMERATION, getLocale(), getDocumentRequest().getFinalAverage(getLocale())), getDocumentRequest().getFinalAverage(getLocale()), BundleUtil.getString(Bundle.ACADEMIC, getLocale(), getDocumentRequest().getQualifiedAverageGrade(getLocale())))); }
@Test public void testGetProgressPercentageDate() { ProjectAssignment assignment = new ProjectAssignment(); assignment.setAssignmentType(new ProjectAssignmentType(EhourConstants.ASSIGNMENT_DATE)); LocalDate base = LocalDate.parse("2015-01-01"); DateTimeUtils.setCurrentMillisFixed(base.toDateTimeAtCurrentTime().getMillis()); assignment.setDateStart(base.minusDays(3).toDate()); assignment.setDateEnd(base.plusDays(3).toDate()); AssignmentAggregateReportElement ele = new AssignmentAggregateReportElement(); ele.setProjectAssignment(assignment); assertEquals(50, ele.getProgressPercentage().get(), 2f); }