List of usage examples for org.joda.time DateTime withTimeAtStartOfDay
public DateTime withTimeAtStartOfDay()
From source file:it.cineca.pst.huborcid.service.OrcidService.java
License:Open Source License
@Scheduled(cron = "0 */5 * * * *") public void countTotal() { EnvVariable total = envVarRepository.findOneByName("orcid.total"); EnvVariable totalDay = envVarRepository.findOneByName("orcid.total.day"); Long totalOrcid = personRepository.countByOrcidIsNotNull(); DateTime date = new DateTime(); date = date.withTimeAtStartOfDay(); //date.toDateTimeAtStartOfDay(); Long totalOrcidDaily = personRepository.countByOrcidIsNotNullAndOrcidReleaseDateGreaterThanEqual(date); total.setVariableValue(totalOrcid.toString()); totalDay.setVariableValue(totalOrcidDaily.toString()); }
From source file:jp.furplag.util.time.DateTimeUtils.java
License:Apache License
/** * if {@code true}, two datetime objects on the specified timezone are on the same day. * * @param aDay if {@code null}, always return {@code false} (not means now) . * @param anotherDay instant the datetime object, null means current datetime. * @param zone TimeZone.//from w w w .ja v a 2 s . c o m * @return {@code true} if they represent the same day. */ public static boolean isSameDay(final Object aDay, final Object anotherDay, final DateTimeZone zone) { DateTime then = toDT(aDay, zone, true); return then != null && then.withTimeAtStartOfDay().isEqual(toDT(anotherDay, zone).withTimeAtStartOfDay()); }
From source file:jp.furplag.util.time.lunisolar.LunisolarDateTimeUtils.java
License:Apache License
public static int getDayOfMonth(final double firstDayOfMonth, final double julianDay, DateTimeZone zone) { DateTime firstDay = toDT(firstDayOfMonth, zone, true); if (firstDay == null) throw new IllegalArgumentException("\"firstDayOfMonth\" must NOT be empty."); DateTime then = toDT(julianDay, zone).withTimeAtStartOfDay(); Interval interval = firstDayOfMonth > julianDay ? new Interval(then, firstDay.withTimeAtStartOfDay()) : new Interval(firstDay.withTimeAtStartOfDay(), then); return (int) interval.toDuration().getStandardDays() + 1; }
From source file:kr.debop4j.core.tools.DateTool.java
License:Apache License
/** * ? DateTime ? moment-part date-part? . * * @param moment the moment/*from w w w . j a va 2 s . c o m*/ * @return the start of day */ public static DateTime getStartOfDay(final DateTime moment) { return moment.withTimeAtStartOfDay(); }
From source file:kr.debop4j.core.tools.DateTool.java
License:Apache License
/** * Gets start of week./*from ww w .j a v a 2 s . c o m*/ * * @param moment the moment * @return the start of week */ public static DateTime getStartOfWeek(final DateTime moment) { int add = DateTimeConstants.MONDAY - moment.getDayOfWeek(); if (add > 0) add -= 7; return moment.withTimeAtStartOfDay().plusDays(add); }
From source file:kr.debop4j.timeperiod.Datepart.java
License:Apache License
/** * Instantiates a new Datepart./*w w w . j ava 2 s .c o m*/ * * @param moment the datetime */ public Datepart(DateTime moment) { this.datepart = moment.withTimeAtStartOfDay(); }
From source file:kr.debop4j.timeperiod.Timepart.java
License:Apache License
/** * Gets date time./*from w ww. j a va 2 s .com*/ * * @param moment the moment * @return the date time */ public DateTime getDateTime(DateTime moment) { return moment.withTimeAtStartOfDay().plus(getMillis()); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** * Gets start of week./*from www.j a va 2 s .c o m*/ * * @param time the time * @param firstDayOfWeek the first day of week * @return the start of week */ public static DateTime getStartOfWeek(DateTime time, DayOfWeek firstDayOfWeek) { DateTime current = time.withTimeAtStartOfDay(); while (current.getDayOfWeek() != firstDayOfWeek.getValue()) { current = current.minusDays(1); } return current; }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** * Day start./*from w w w . j av a 2s . co m*/ * * @param moment the moment * @return the date time */ public static DateTime dayStart(DateTime moment) { return moment.withTimeAtStartOfDay(); }
From source file:kr.debop4j.timeperiod.tools.Times.java
License:Apache License
/** * Start time of day.//from w w w. j av a 2s.c om * * @param moment the moment * @return the date time */ public static DateTime startTimeOfDay(DateTime moment) { return moment.withTimeAtStartOfDay(); }