List of usage examples for org.joda.time DateTime withMillisOfSecond
public DateTime withMillisOfSecond(int millis)
From source file:org.kairosdb.core.aggregator.RangeAggregator.java
License:Apache License
/** For YEARS, MONTHS, WEEKS, DAYS://from w ww . jav a 2 s . c o m Computes the timestamp of the first millisecond of the day of the timestamp. For HOURS, Computes the timestamp of the first millisecond of the hour of the timestamp. For MINUTES, Computes the timestamp of the first millisecond of the minute of the timestamp. For SECONDS, Computes the timestamp of the first millisecond of the second of the timestamp. For MILLISECONDS, returns the timestamp @param timestamp @return */ private long alignRangeBoundary(long timestamp) { DateTime dt = new DateTime(timestamp, m_timeZone); TimeUnit tu = m_sampling.getUnit(); switch (tu) { case YEARS: dt = dt.withDayOfYear(1).withMillisOfDay(0); break; case MONTHS: dt = dt.withDayOfMonth(1).withMillisOfDay(0); break; case WEEKS: dt = dt.withDayOfWeek(1).withMillisOfDay(0); break; case DAYS: case HOURS: case MINUTES: case SECONDS: dt = dt.withHourOfDay(0); dt = dt.withMinuteOfHour(0); dt = dt.withSecondOfMinute(0); default: dt = dt.withMillisOfSecond(0); break; } return dt.getMillis(); }
From source file:org.yamj.api.trakttv.model.SyncMovie.java
License:Open Source License
public SyncMovie collectedAt(DateTime collectedAt) { this.collectedAt = collectedAt == null ? null : collectedAt.withMillisOfSecond(0); return this; }
From source file:org.yamj.api.trakttv.model.SyncMovie.java
License:Open Source License
public SyncMovie watchedAt(DateTime watchedAt) { this.watchedAt = watchedAt == null ? null : watchedAt.withMillisOfSecond(0); return this; }