Java Code Examples for org.joda.time.DateTime#toInstant()
The following examples show how to use
org.joda.time.DateTime#toInstant() .
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: beam File: PersonGenerator.java License: 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 Project: beam File: CalendarWindows.java License: 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 Project: beam File: CalendarWindows.java License: 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 Project: beam File: KinesisServiceMock.java License: 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 Project: spring-analysis-note File: JodaTimeConverters.java License: MIT License | 4 votes |
@Override public Instant convert(DateTime source) { return source.toInstant(); }
Example 6
Source Project: java-technology-stack File: JodaTimeConverters.java License: MIT License | 4 votes |
@Override public Instant convert(DateTime source) { return source.toInstant(); }
Example 7
Source Project: lams File: JodaTimeConverters.java License: GNU General Public License v2.0 | 4 votes |
@Override public Instant convert(DateTime source) { return source.toInstant(); }
Example 8
Source Project: spring4-understanding File: JodaTimeConverters.java License: Apache License 2.0 | 4 votes |
@Override public Instant convert(DateTime source) { return source.toInstant(); }
Example 9
Source Project: beam File: CalendarWindows.java License: 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()); }