Java Code Examples for org.joda.time.DateTime#toLocalDateTime()
The following examples show how to use
org.joda.time.DateTime#toLocalDateTime() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SegmentGenerationWithTimeColumnTest.java From incubator-pinot with Apache License 2.0 | 5 votes |
@Test public void testMinAllowedValue() { long millis = validMinTime; // is in UTC from epoch (19710101) DateTime dateTime = new DateTime(millis, DateTimeZone.UTC); LocalDateTime localDateTime = dateTime.toLocalDateTime(); int year = localDateTime.getYear(); int month = localDateTime.getMonthOfYear(); int day = localDateTime.getDayOfMonth(); Assert.assertEquals(year, 1971); Assert.assertEquals(month, 1); Assert.assertEquals(day, 1); }
Example 2
Source File: SegmentGenerationWithTimeColumnTest.java From incubator-pinot with Apache License 2.0 | 5 votes |
private Object getRandomValueForTimeColumn(boolean isSimpleDate, boolean isInvalidDate) { long randomMs = validMinTime + (long) (_random.nextDouble() * (startTime - validMinTime)); Preconditions.checkArgument(TimeUtils.timeValueInValidRange(randomMs), "Value " + randomMs + " out of range"); long dateColVal = randomMs; Object result; if (isInvalidDate) { result = new Long(new DateTime(2072, 1, 1, 0, 0, 0, 0, DateTimeZone.UTC).getMillis()); return result; } else if (isSimpleDate) { DateTime dateTime = new DateTime(randomMs, DateTimeZone.UTC); LocalDateTime localDateTime = dateTime.toLocalDateTime(); int year = localDateTime.getYear(); int month = localDateTime.getMonthOfYear(); int day = localDateTime.getDayOfMonth(); String dateColStr = String.format("%04d%02d%02d", year, month, day); dateColVal = Integer.valueOf(dateColStr); result = new Integer(Integer.valueOf(dateColStr)); } else { result = new Long(dateColVal); } if (dateColVal < minTime) { minTime = dateColVal; } if (dateColVal > maxTime) { maxTime = dateColVal; } return result; }
Example 3
Source File: TimestampColumnLocalDateTimeMapper.java From jadira with Apache License 2.0 | 5 votes |
@Override public LocalDateTime fromNonNullValue(Timestamp value) { DateTime dateTime = new DateTime(value.getTime()); LocalDateTime localDateTime = dateTime.toLocalDateTime(); return localDateTime; }
Example 4
Source File: JodaTimeConverters.java From spring-analysis-note with MIT License | 4 votes |
@Override public LocalDateTime convert(DateTime source) { return source.toLocalDateTime(); }
Example 5
Source File: JodaTimeConverters.java From java-technology-stack with MIT License | 4 votes |
@Override public LocalDateTime convert(DateTime source) { return source.toLocalDateTime(); }
Example 6
Source File: JodaTimeConverters.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public LocalDateTime convert(DateTime source) { return source.toLocalDateTime(); }
Example 7
Source File: JodaTimeConverters.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public LocalDateTime convert(DateTime source) { return source.toLocalDateTime(); }
Example 8
Source File: PersistentDateTimeWithZone.java From jadira with Apache License 2.0 | 4 votes |
@Override protected Object[] toConvertedColumns(DateTime value) { return new Object[] { value.toLocalDateTime(), new DateTimeZoneWithOffset(value.getZone(), value.getZone().isFixed() ? null : DateTimeZone.forOffsetMillis(value.getZone().getOffset(value))) }; }
Example 9
Source File: PersistentDateTimeAndZone.java From jadira with Apache License 2.0 | 4 votes |
@Override protected Object[] toConvertedColumns(DateTime value) { return new Object[] { value.toLocalDateTime(), value.getZone() }; }
Example 10
Source File: PersistentDateTimeAsString.java From jadira with Apache License 2.0 | 4 votes |
@Override protected Object[] toConvertedColumns(DateTime value) { return new Object[] { value.toLocalDateTime(), new DateTimeZoneWithOffset(value.getZone(), value.getZone().isFixed() ? null : DateTimeZone.forOffsetMillis(value.getZone().getOffset(value))) }; }
Example 11
Source File: PersistentDateTimeAndZoneWithOffset.java From jadira with Apache License 2.0 | 4 votes |
@Override protected Object[] toConvertedColumns(DateTime value) { return new Object[] { value.toLocalDateTime(), new DateTimeZoneWithOffset(value.getZone(), value.getZone().isFixed() ? null : DateTimeZone.forOffsetMillis(value.getZone().getOffset(value))) }; }