Example usage for org.joda.time LocalDateTime getMillisOfSecond

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

Introduction

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

Prototype

public int getMillisOfSecond() 

Source Link

Document

Get the millis of second field value.

Usage

From source file:org.netxilia.api.utils.DateUtils.java

License:Open Source License

public static LocalDateTime toLocalDateTime(ReadablePartial partial, LocalDateTime fullDateTime) {
    if (partial instanceof LocalDateTime) {
        return (LocalDateTime) partial;
    }//from ww w.j  a  v a2  s .  c om
    if (partial instanceof LocalDate) {
        LocalDate d = (LocalDate) partial;
        return new LocalDateTime(d.getYear(), d.getMonthOfYear(), d.getDayOfMonth(),
                fullDateTime.getHourOfDay(), fullDateTime.getMinuteOfHour(), fullDateTime.getSecondOfMinute(),
                fullDateTime.getMillisOfSecond());
    }

    if (partial instanceof LocalTime) {
        LocalTime t = (LocalTime) partial;
        return new LocalDateTime(fullDateTime.getYear(), fullDateTime.getMonthOfYear(),
                fullDateTime.getDayOfMonth(), t.getHourOfDay(), t.getMinuteOfHour(), t.getSecondOfMinute(),
                t.getMillisOfSecond());
    }

    throw new IllegalArgumentException("The partial parameter has an unsupported class:" + partial.getClass());
}

From source file:propel.core.utils.ConversionUtils.java

License:Open Source License

/**
 * Converts a Joda LocalDateTime object to an XML Gregorian Calendar data type
 *//*from   www .ja v a2s  .co m*/
@Validate
public static XMLGregorianCalendar toXMLGregorianCalendar(@NotNull final LocalDateTime value)
        throws DatatypeConfigurationException {
    val gc = new GregorianCalendar(value.getYear(), value.getMonthOfYear() - 1, value.getDayOfMonth(),
            value.getHourOfDay(), value.getMinuteOfHour(), value.getSecondOfMinute());
    gc.set(Calendar.MILLISECOND, value.getMillisOfSecond());

    return DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
}

From source file:siddur.solidtrust.azure.AzureConnector.java

private static Date toDate(LocalDateTime l) {
    Calendar c = Calendar.getInstance();
    c.set(Calendar.YEAR, l.getYear());
    c.set(Calendar.DAY_OF_YEAR, l.getDayOfYear());
    c.set(Calendar.HOUR_OF_DAY, l.getHourOfDay());
    c.set(Calendar.MINUTE, l.getMinuteOfHour());
    c.set(Calendar.SECOND, l.getSecondOfMinute());
    c.set(Calendar.MILLISECOND, l.getMillisOfSecond());
    return c.getTime();
}