Java Code Examples for org.joda.time.DateTime#toLocalDateTime()
The following examples show how to use
org.joda.time.DateTime#toLocalDateTime() .
These examples are extracted from open source projects.
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 Project: incubator-pinot File: SegmentGenerationWithTimeColumnTest.java License: 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 Project: incubator-pinot File: SegmentGenerationWithTimeColumnTest.java License: 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 Project: jadira File: TimestampColumnLocalDateTimeMapper.java License: 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 Project: spring-analysis-note File: JodaTimeConverters.java License: MIT License | 4 votes |
@Override public LocalDateTime convert(DateTime source) { return source.toLocalDateTime(); }
Example 5
Source Project: java-technology-stack File: JodaTimeConverters.java License: MIT License | 4 votes |
@Override public LocalDateTime convert(DateTime source) { return source.toLocalDateTime(); }
Example 6
Source Project: lams File: JodaTimeConverters.java License: GNU General Public License v2.0 | 4 votes |
@Override public LocalDateTime convert(DateTime source) { return source.toLocalDateTime(); }
Example 7
Source Project: spring4-understanding File: JodaTimeConverters.java License: Apache License 2.0 | 4 votes |
@Override public LocalDateTime convert(DateTime source) { return source.toLocalDateTime(); }
Example 8
Source Project: jadira File: PersistentDateTimeWithZone.java License: 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 Project: jadira File: PersistentDateTimeAndZone.java License: Apache License 2.0 | 4 votes |
@Override protected Object[] toConvertedColumns(DateTime value) { return new Object[] { value.toLocalDateTime(), value.getZone() }; }
Example 10
Source Project: jadira File: PersistentDateTimeAsString.java License: 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 Project: jadira File: PersistentDateTimeAndZoneWithOffset.java License: 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))) }; }