Example usage for org.joda.time LocalDateTime LocalDateTime

List of usage examples for org.joda.time LocalDateTime LocalDateTime

Introduction

In this page you can find the example usage for org.joda.time LocalDateTime LocalDateTime.

Prototype

public LocalDateTime(Object instant) 

Source Link

Document

Constructs an instance from an Object that represents a datetime.

Usage

From source file:org.apache.fineract.accounting.closure.storeglaccountbalance.data.GLClosureJournalEntryBalanceData.java

License:Apache License

/**
 * Creates a new {@link GLClosureJournalEntryBalanceData} object
 * // ww w.  j  ava  2s .  com
 * @param glClosureJournalEntryBalance {@link GLClosureJournalEntryBalance} object
 * @return {@link GLClosureJournalEntryBalanceData} object
 */
public static GLClosureJournalEntryBalanceData newGLClosureBalanceData(
        final GLClosureJournalEntryBalance glClosureJournalEntryBalance) {
    LocalDateTime createdDate = null;
    LocalDateTime lastModifiedDate = null;
    String createdByUsername = null;
    String lastModifiedByUsername = null;
    Long createdByUserId = null;
    Long lastModifiedByUserId = null;
    Long glClosureId = null;
    Long glAccountId = null;

    if (glClosureJournalEntryBalance.getCreatedBy() != null) {
        createdByUsername = glClosureJournalEntryBalance.getCreatedBy().getUsername();
        createdByUserId = glClosureJournalEntryBalance.getCreatedBy().getId();
    }

    if (glClosureJournalEntryBalance.getLastModifiedBy() != null) {
        lastModifiedByUsername = glClosureJournalEntryBalance.getLastModifiedBy().getUsername();
        lastModifiedByUserId = glClosureJournalEntryBalance.getLastModifiedBy().getId();
    }

    if (glClosureJournalEntryBalance.getCreatedDate() != null) {
        createdDate = new LocalDateTime(glClosureJournalEntryBalance.getCreatedDate());
    }

    if (glClosureJournalEntryBalance.getLastModifiedDate() != null) {
        lastModifiedDate = new LocalDateTime(glClosureJournalEntryBalance.getLastModifiedDate());
    }

    if (glClosureJournalEntryBalance.getGlAccount() != null) {
        glAccountId = glClosureJournalEntryBalance.getGlAccount().getId();
    }

    if (glClosureJournalEntryBalance.getGlClosure() != null) {
        glClosureId = glClosureJournalEntryBalance.getGlClosure().getId();
    }

    return new GLClosureJournalEntryBalanceData(glClosureJournalEntryBalance.getId(), glClosureId, glAccountId,
            glClosureJournalEntryBalance.getAmount(), createdDate, createdByUserId, createdByUsername,
            lastModifiedDate, lastModifiedByUserId, lastModifiedByUsername,
            glClosureJournalEntryBalance.isDeleted());
}

From source file:org.apache.isis.core.progmodel.facets.value.datetimejodalocal.JodaLocalDateTimeValueSemanticsProvider.java

License:Apache License

@Override
protected LocalDateTime setDate(final Date date) {
    return new LocalDateTime(date.getTime());
}

From source file:org.apache.sqoop.connector.matcher.SchemaFixture.java

License:Apache License

public static Object[] createNotNullRecordForSchema1() {
    Object[] fields = new Object[2];
    fields[0] = "some text";
    fields[1] = new LocalDateTime("2015-01-01");
    return fields;
}

From source file:org.assertj.jodatime.api.LocalDateTimeAssert.java

License:Apache License

/**
 * Same assertion as {@link #isBefore(LocalDateTime)} but the {@link LocalDateTime} is built from given String, which
 * must follow <a href=//from  ww  w .j  av  a2 s.co  m
 * "http://joda-time.sourceforge.net/api-release/org/joda/time/format/ISODateTimeFormat.html#localDateOptionalTimeParser()"
 * >ISO DateTime format</a> to allow calling {@link LocalDateTime#LocalDateTime(Object) LocalDateTime(Object)}
 * constructor.
 * <p>
 * Example :
 * <pre><code class='java'> // use directly String in comparison to avoid a conversion
 * assertThat(new LocalDateTime(&quot;2000-01-01&quot;)).isBefore(&quot;2000-01-02&quot;);</code></pre>
 * 
 * @param localDateTimeAsString String representing a {@link LocalDateTime}.
 * @return this assertion object.
 * @throws AssertionError if the actual {@code LocalDateTime} is {@code null}.
 * @throws IllegalArgumentException if given String is null or can't be converted to a {@link LocalDateTime}.
 * @throws AssertionError if the actual {@code LocalDateTime} is not strictly before the {@link LocalDateTime} built
 *           from given String.
 */
public LocalDateTimeAssert isBefore(String localDateTimeAsString) {
    assertLocalDateTimeAsStringParameterIsNotNull(localDateTimeAsString);
    return isBefore(new LocalDateTime(localDateTimeAsString));
}

From source file:org.assertj.jodatime.api.LocalDateTimeAssert.java

License:Apache License

/**
 * Same assertion as {@link #isBeforeOrEqualTo(LocalDateTime)} but the {@link LocalDateTime} is built from given
 * String, which must follow <a href=
 * "http://joda-time.sourceforge.net/api-release/org/joda/time/format/ISODateTimeFormat.html#localDateOptionalTimeParser()"
 * >ISO DateTime format</a> to allow calling {@link LocalDateTime#LocalDateTime(Object) LocalDateTime(Object)}
 * constructor./*from w w  w .j  av  a2  s  .  c o  m*/
 * <p>
 * Example :
 * <pre><code class='java'> // use String in comparison to avoid conversion
 * assertThat(new LocalDateTime(&quot;2000-01-01&quot;)).isBeforeOrEqualTo(&quot;2000-01-01&quot;)
 *                                            .isBeforeOrEqualTo(&quot;2000-01-02&quot;);</code></pre>
 * 
 * @param localDateTimeAsString String representing a {@link LocalDateTime}.
 * @return this assertion object.
 * @throws AssertionError if the actual {@code LocalDateTime} is {@code null}.
 * @throws IllegalArgumentException if given String is null or can't be converted to a {@link LocalDateTime}.
 * @throws AssertionError if the actual {@code LocalDateTime} is not before or equals to the {@link LocalDateTime}
 *           built from given String.
 */
public LocalDateTimeAssert isBeforeOrEqualTo(String localDateTimeAsString) {
    assertLocalDateTimeAsStringParameterIsNotNull(localDateTimeAsString);
    return isBeforeOrEqualTo(new LocalDateTime(localDateTimeAsString));
}

From source file:org.assertj.jodatime.api.LocalDateTimeAssert.java

License:Apache License

/**
 * Same assertion as {@link #isAfterOrEqualTo(LocalDateTime)} but the {@link LocalDateTime} is built from given
 * String, which must follow <a href=
 * "http://joda-time.sourceforge.net/api-release/org/joda/time/format/ISODateTimeFormat.html#localDateOptionalTimeParser()"
 * >ISO DateTime format</a> to allow calling {@link LocalDateTime#LocalDateTime(Object) LocalDateTime(Object)}
 * constructor./*from  ww w  .  j  a va  2 s.  co m*/
 * <p>
 * Example :
 * <pre><code class='java'> // use String in comparison to avoid conversion
 * assertThat(new LocalDateTime(&quot;2000-01-01&quot;)).isAfterOrEqualTo(&quot;2000-01-01&quot;)
 *                                            .isAfterOrEqualTo(&quot;1999-12-31&quot;);</code></pre>
 * 
 * @param localDateTimeAsString String representing a {@link LocalDateTime}.
 * @return this assertion object.
 * @throws AssertionError if the actual {@code LocalDateTime} is {@code null}.
 * @throws IllegalArgumentException if given String is null or can't be converted to a {@link LocalDateTime}.
 * @throws AssertionError if the actual {@code LocalDateTime} is not after or equals to the {@link LocalDateTime}
 *           built from given String.
 */
public LocalDateTimeAssert isAfterOrEqualTo(String localDateTimeAsString) {
    assertLocalDateTimeAsStringParameterIsNotNull(localDateTimeAsString);
    return isAfterOrEqualTo(new LocalDateTime(localDateTimeAsString));
}

From source file:org.assertj.jodatime.api.LocalDateTimeAssert.java

License:Apache License

/**
 * Same assertion as {@link #isAfter(LocalDateTime)} but the {@link LocalDateTime} is built from given a String that
 * must follow <a href=//from ww w. ja va 2  s .  com
 * "http://joda-time.sourceforge.net/api-release/org/joda/time/format/ISODateTimeFormat.html#localDateOptionalTimeParser()"
 * >ISO DateTime format</a> to allow calling {@link LocalDateTime#LocalDateTime(Object) LocalDateTime(Object)}
 * constructor.
 * <p>
 * Example :
 * <pre><code class='java'> // use String in comparison to avoid conversion
 * assertThat(new LocalDateTime(&quot;2000-01-01&quot;)).isAfter(&quot;1999-12-31&quot;);</code></pre>
 * 
 * @param localDateTimeAsString String representing a {@link LocalDateTime}.
 * @return this assertion object.
 * @throws AssertionError if the actual {@code LocalDateTime} is {@code null}.
 * @throws IllegalArgumentException if given String is null or can't be converted to a {@link LocalDateTime}.
 * @throws AssertionError if the actual {@code LocalDateTime} is not strictly after the {@link LocalDateTime} built
 *           from given String.
 */
public LocalDateTimeAssert isAfter(String localDateTimeAsString) {
    assertLocalDateTimeAsStringParameterIsNotNull(localDateTimeAsString);
    return isAfter(new LocalDateTime(localDateTimeAsString));
}

From source file:org.assertj.jodatime.api.LocalDateTimeAssert.java

License:Apache License

/**
 * Same assertion as {@link #isEqualTo(Object)} (where Object is expected to be {@link LocalDateTime}) but here you
 * pass {@link LocalDateTime} String representation that must follow <a href=
 * "http://joda-time.sourceforge.net/api-release/org/joda/time/format/ISODateTimeFormat.html#localDateOptionalTimeParser()"
 * >ISO DateTime format</a> to allow calling {@link LocalDateTime#LocalDateTime(Object) LocalDateTime(Object)}
 * constructor./*from w w w  . jav a2 s  . c  o m*/
 * <p>
 * Example :
 * <pre><code class='java'> // use directly String in comparison to avoid a conversion
 * assertThat(new LocalDateTime(&quot;2000-01-01&quot;)).isEqualTo(&quot;2000-01-01&quot;);</code></pre>
 * 
 * @param dateTimeAsString String representing a {@link LocalDateTime}.
 * @return this assertion object.
 * @throws AssertionError if the actual {@code LocalDateTime} is {@code null}.
 * @throws IllegalArgumentException if given String is null or can't be converted to a {@link LocalDateTime}.
 * @throws AssertionError if the actual {@code LocalDateTime} is not equal to the {@link LocalDateTime} built from
 *           given String.
 */
public LocalDateTimeAssert isEqualTo(String dateTimeAsString) {
    assertLocalDateTimeAsStringParameterIsNotNull(dateTimeAsString);
    return isEqualTo(new LocalDateTime(dateTimeAsString));
}

From source file:org.assertj.jodatime.api.LocalDateTimeAssert.java

License:Apache License

/**
 * Same assertion as {@link #isNotEqualTo(Object)} (where Object is expected to be {@link LocalDateTime}) but here you
 * pass {@link LocalDateTime} String representation that must follow <a href=
 * "http://joda-time.sourceforge.net/api-release/org/joda/time/format/ISODateTimeFormat.html#localDateOptionalTimeParser()"
 * >ISO DateTime format</a> to allow calling {@link LocalDateTime#LocalDateTime(Object) LocalDateTime(Object)}
 * constructor./*from   w  ww.  j a  v a  2 s  . co m*/
 * <p>
 * Example :
 * <pre><code class='java'> // use directly String in comparison to avoid a conversion
 * assertThat(new LocalDateTime(&quot;2000-01-01&quot;)).isNotEqualTo(&quot;2000-01-15&quot;);</code></pre>
 * 
 * @param dateTimeAsString String representing a {@link LocalDateTime}.
 * @return this assertion object.
 * @throws AssertionError if the actual {@code LocalDateTime} is {@code null}.
 * @throws IllegalArgumentException if given String is null or can't be converted to a {@link LocalDateTime}.
 * @throws AssertionError if the actual {@code LocalDateTime} is equal to the {@link LocalDateTime} built from given
 *           String.
 */
public LocalDateTimeAssert isNotEqualTo(String dateTimeAsString) {
    assertLocalDateTimeAsStringParameterIsNotNull(dateTimeAsString);
    return isNotEqualTo(new LocalDateTime(dateTimeAsString));
}

From source file:org.assertj.jodatime.api.LocalDateTimeAssert.java

License:Apache License

private static Object[] convertToLocalDateTimeArray(String... dateTimesAsString) {
    LocalDateTime[] dates = new LocalDateTime[dateTimesAsString.length];
    for (int i = 0; i < dateTimesAsString.length; i++) {
        dates[i] = new LocalDateTime(dateTimesAsString[i]);
    }//from www .  j  av a2 s .  c om
    return dates;
}