Java Code Examples for org.joda.time.DateTime#toInstant()
The following examples show how to use
org.joda.time.DateTime#toInstant() .
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: PersonGenerator.java From beam with Apache License 2.0 | 5 votes |
/** Generate and return a random person with next available id. */ public static Person nextPerson( long nextEventId, Random random, DateTime timestamp, GeneratorConfig config) { long id = lastBase0PersonId(nextEventId) + GeneratorConfig.FIRST_PERSON_ID; String name = nextPersonName(random); String email = nextEmail(random); String creditCard = nextCreditCard(random); String city = nextUSCity(random); String state = nextUSState(random); int currentSize = 8 + name.length() + email.length() + creditCard.length() + city.length() + state.length(); String extra = nextExtra(random, currentSize, config.getAvgPersonByteSize()); return new Person(id, name, email, creditCard, city, state, timestamp.toInstant(), extra); }
Example 2
Source File: CalendarWindows.java From beam with Apache License 2.0 | 5 votes |
@Override public IntervalWindow assignWindow(Instant timestamp) { DateTime datetime = new DateTime(timestamp, timeZone); int dayOffset = Days.daysBetween(startDate, datetime).getDays() / number * number; DateTime begin = startDate.plusDays(dayOffset); DateTime end = begin.plusDays(number); return new IntervalWindow(begin.toInstant(), end.toInstant()); }
Example 3
Source File: CalendarWindows.java From beam with Apache License 2.0 | 5 votes |
@Override public IntervalWindow assignWindow(Instant timestamp) { DateTime datetime = new DateTime(timestamp, timeZone); int monthOffset = Months.monthsBetween(startDate.withDayOfMonth(dayOfMonth), datetime).getMonths() / number * number; DateTime begin = startDate.withDayOfMonth(dayOfMonth).plusMonths(monthOffset); DateTime end = begin.plusMonths(number); return new IntervalWindow(begin.toInstant(), end.toInstant()); }
Example 4
Source File: KinesisServiceMock.java From beam with Apache License 2.0 | 5 votes |
public synchronized void addShardedData(ByteBuffer data, DateTime arrival) { String dataString = StandardCharsets.UTF_8.decode(data).toString(); List<AmazonKinesisMock.TestData> shardData = shardedData.get(0); seqNumber.incrementAndGet(); AmazonKinesisMock.TestData testData = new AmazonKinesisMock.TestData( dataString, arrival.toInstant(), Integer.toString(seqNumber.get())); shardData.add(testData); addedRecords.incrementAndGet(); }
Example 5
Source File: JodaTimeConverters.java From spring-analysis-note with MIT License | 4 votes |
@Override public Instant convert(DateTime source) { return source.toInstant(); }
Example 6
Source File: JodaTimeConverters.java From java-technology-stack with MIT License | 4 votes |
@Override public Instant convert(DateTime source) { return source.toInstant(); }
Example 7
Source File: JodaTimeConverters.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Instant convert(DateTime source) { return source.toInstant(); }
Example 8
Source File: JodaTimeConverters.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public Instant convert(DateTime source) { return source.toInstant(); }
Example 9
Source File: CalendarWindows.java From beam with Apache License 2.0 | 3 votes |
@Override public IntervalWindow assignWindow(Instant timestamp) { DateTime datetime = new DateTime(timestamp, timeZone); DateTime offsetStart = startDate.withMonthOfYear(monthOfYear).withDayOfMonth(dayOfMonth); int yearOffset = Years.yearsBetween(offsetStart, datetime).getYears() / number * number; DateTime begin = offsetStart.plusYears(yearOffset); DateTime end = begin.plusYears(number); return new IntervalWindow(begin.toInstant(), end.toInstant()); }