List of usage examples for org.joda.time LocalDate toString
@ToString
public String toString()
From source file:org.apache.isis.schema.utils.jaxbadapters.JodaLocalDateStringAdapter.java
License:Apache License
public static String print(LocalDate date) { return date != null ? date.toString() : null; }
From source file:org.apache.niolex.common.joda.Joda.java
License:Apache License
/** * @param args/*from w ww .j av a 2 s . c om*/ */ public static void main(String[] args) { Locale.setDefault(Locale.ENGLISH); // --- ? LocalDate now = new LocalDate(); LocalDate lastDayOfPreviousMonth = now.minusMonths(1).dayOfMonth().withMaximumValue(); // - Print SystemUtil.println(lastDayOfPreviousMonth.toString()); // --- 11 ? LocalDate electionDate = now.monthOfYear().setCopy(11) // November .dayOfMonth() // Access Day Of Month Property .withMinimumValue() // Get its minimum value .plusDays(6) // Add 6 days .dayOfWeek() // Access Day Of Week Property .setCopy("Monday") // Set to Monday (it will round down) .plusDays(1); // Gives us Tuesday // - Print SystemUtil.println(electionDate.toString()); // --- ?? LocalDate then = now.plusWeeks(2); // - Print SystemUtil.println(then.toString()); }
From source file:org.apereo.portlet.hr.demo.timereporting.dao.DemoStaffTimeReportingImpl.java
License:Apache License
private static String encodeJobAndDate(int jobCode, LocalDate date) { return Integer.toString(jobCode) + "_" + date.toString(); }
From source file:org.biokoframework.system.repository.sql.translator.annotation.impl.LocalDateTranslator.java
License:Open Source License
@Override public String convertFromDBValue(String fieldName, ResultSet resultset, Field fieldAnnotation) throws SQLException { String sqlFieldValue = resultset.getString(fieldName); if (sqlFieldValue == null) { return null; } else {//from www. j av a 2 s . c o m LocalDate timestamp = DateTimeFormat.forPattern(MYSQL_DATE).parseLocalDate(sqlFieldValue); return timestamp.toString(); } }
From source file:org.datanucleus.store.types.jodatime.converters.JodaLocalDateStringConverter.java
License:Open Source License
public String toDatastoreType(LocalDate ld) { return ld != null ? ld.toString() : null; }
From source file:org.devmaster.elasticsearch.script.NextOccurrenceSearchScript.java
License:Apache License
@Override public Object run() { Recurring recurring = getRecurring(getParamValueFor(PARAM_FIELD)); if (recurring != null) { String fromParam = getParamValueFor(PARAM_FROM); LocalDate date = fromParam != null ? new LocalDate(fromParam) : LocalDate.now(); try {// w w w. j a v a2 s . co m LocalDate nextOccurrence = recurring.getNextOccurrence(date); return nextOccurrence != null ? nextOccurrence.toString() : null; } catch (ParseException ignored) { } } return null; }
From source file:org.estatio.api.Api.java
License:Apache License
private LeaseTerm putLeaseTerm(final String leaseReference, final String unitReference, final BigInteger itemSequence, final String itemType, final LocalDate itemStartDate, final LocalDate startDate, final LocalDate endDate, final BigInteger sequence, final String statusStr) { final Lease lease = fetchLease(leaseReference); final Unit unit; if (unitReference != null) { unit = units.findUnitByReference(unitReference); if (unitReference != null && unit == null) { throw new ApplicationException(String.format("Unit with reference %s not found.", unitReference)); }/*from ww w . j a v a 2 s. c o m*/ } final LeaseItemType leaseItemType = fetchLeaseItemType(itemType); final LeaseItem item = lease.findItem(leaseItemType, itemStartDate, itemSequence); if (item == null) { throw new ApplicationException( String.format("LeaseItem with reference %1$s, %2$s, %3$s, %4$s not found.", leaseReference, leaseItemType.toString(), itemStartDate.toString(), itemSequence.toString())); } LeaseTerm term = item.findTermWithSequence(sequence); if (term == null) { if (sequence.equals(BigInteger.ONE)) { term = item.newTerm(startDate, endDate); } else { final LeaseTerm previousTerm = item.findTermWithSequence(sequence.subtract(BigInteger.ONE)); term = previousTerm.createNext(startDate, endDate); } term.setSequence(sequence); } term.setStatus(org.estatio.dom.lease.LeaseTermStatus.valueOf(statusStr)); return term; }
From source file:org.estatio.dom.invoice.Invoice.java
License:Apache License
@Programmatic public Invoice doInvoice(final @ParameterLayout(named = "Invoice date") LocalDate invoiceDate) { // bulk action, so need these guards if (disableInvoice(invoiceDate, true) != null) { return this; }/*from w w w .j a v a 2 s . c om*/ if (!validInvoiceDate(invoiceDate)) { warnUser(String.format( "Invoice date %d is invalid for %s becuase it's before the invoice date of the last invoice", invoiceDate.toString(), getContainer().titleOf(this))); return this; } final Numerator numerator = collectionNumerators.findInvoiceNumberNumerator(getFixedAsset()); setInvoiceNumber(numerator.nextIncrementStr()); setInvoiceDate(invoiceDate); this.setStatus(InvoiceStatus.INVOICED); informUser("Assigned " + this.getInvoiceNumber() + " to invoice " + getContainer().titleOf(this)); return this; }
From source file:org.estatio.dom.utils.CalendarUtils.java
License:Apache License
public static List<Interval> intervalsInRange(final LocalDate startDate, final LocalDate endDate, final String rrule) { if (startDate.compareTo(endDate) > 0) { throw new IllegalArgumentException( String.format("Start date %s is after end date %s", startDate.toString(), endDate.toString())); }//from w ww . java 2 s . com List<Interval> intervals = Lists.newArrayList(); LocalDate start = startDate; Interval interval = null; do { interval = intervalContaining(start, rrule); if (interval != null) { intervals.add(interval); start = interval.getEnd().toLocalDate(); } } while (interval != null && start.isBefore(endDate)); return intervals; }
From source file:org.fornax.cartridges.sculptor.framework.xml.JodaLocalDateXmlAdapter.java
License:Apache License
@Override public String marshal(LocalDate localDate) throws Exception { // toString is in ISO8601 yyyy-MM-dd return localDate.toString(); }