本文整理了Java中org.joda.time.LocalDate.toDateTimeAtStartOfDay()
方法的一些代码示例,展示了LocalDate.toDateTimeAtStartOfDay()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.toDateTimeAtStartOfDay()
方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:toDateTimeAtStartOfDay
[英]Converts this LocalDate to a full datetime at the earliest valid time for the date using the default time zone.
The time will normally be midnight, as that is the earliest time on any given day. However, in some time zones when Daylight Savings Time starts, there is no midnight because time jumps from 11:59 to 01:00. This method handles that situation by returning 01:00 on that date.
This instance is immutable and unaffected by this method call.
[中]将此LocalDate转换为使用默认时区的日期的最早有效时间的完整日期时间。
时间通常是午夜,因为这是任何一天最早的时间。然而,在夏令时开始的某些时区中,没有午夜,因为时间从11:59跳到01:00。此方法通过在该日期返回01:00来处理该情况。
此实例是不可变的,不受此方法调用的影响。
代码示例来源:origin: joda-time/joda-time
/**
* Converts this LocalDate to a full datetime at the earliest valid time
* for the date using the default time zone.
* <p>
* The time will normally be midnight, as that is the earliest time on
* any given day. However, in some time zones when Daylight Savings Time
* starts, there is no midnight because time jumps from 11:59 to 01:00.
* This method handles that situation by returning 01:00 on that date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return this date as a datetime at the start of the day
* @since 1.5
*/
public DateTime toDateTimeAtStartOfDay() {
return toDateTimeAtStartOfDay(null);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Converts this LocalDate to a full datetime at the earliest valid time
* for the date using the default time zone.
* <p>
* The time will normally be midnight, as that is the earliest time on
* any given day. However, in some time zones when Daylight Savings Time
* starts, there is no midnight because time jumps from 11:59 to 01:00.
* This method handles that situation by returning 01:00 on that date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return this date as a datetime at the start of the day
* @since 1.5
*/
public DateTime toDateTimeAtStartOfDay() {
return toDateTimeAtStartOfDay(null);
}
代码示例来源:origin: spring-projects/spring-data-examples
@Override
public void removedExpiredAccounts(LocalDate reference) {
template.update("DELETE Account AS a WHERE a.expiryDate < ?", reference.toDateTimeAtStartOfDay().toDate());
}
}
代码示例来源:origin: stackoverflow.com
import org.joda.time.Chronology;
import org.joda.time.LocalDate;
import org.joda.time.chrono.IslamicChronology;
import org.joda.time.chrono.ISOChronology;
public class Test {
public static void main(String[] args) throws Exception {
Chronology iso = ISOChronology.getInstanceUTC();
Chronology hijri = IslamicChronology.getInstanceUTC();
LocalDate todayIso = new LocalDate(2013, 3, 31, iso);
LocalDate todayHijri = new LocalDate(todayIso.toDateTimeAtStartOfDay(),
hijri);
System.out.println(todayHijri); // 1434-05-19
}
}
代码示例来源:origin: spring-projects/spring-data-examples
public static BooleanExpression expiresBefore(LocalDate date) {
return account.expiryDate.before(date.toDateTimeAtStartOfDay().toDate());
}
}
代码示例来源:origin: spring-projects/spring-data-examples
@Override
public void removedExpiredAccounts(LocalDate reference) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Account> query = cb.createQuery(Account.class);
Root<Account> account = query.from(Account.class);
query.where(cb.lessThan(account.get("expiryDate").as(Date.class), reference.toDateTimeAtStartOfDay().toDate()));
for (Account each : em.createQuery(query).getResultList()) {
em.remove(each);
}
}
}
代码示例来源:origin: spring-projects/spring-data-examples
@Override
public Predicate toPredicate(Root<Customer> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
Root<Account> accounts = query.from(Account.class);
Path<Date> expiryDate = accounts.<Date> get("expiryDate");
Predicate customerIsAccountOwner = cb.equal(accounts.<Customer> get("customer"), root);
Predicate accountExpiryDateBefore = cb.lessThan(expiryDate, date.toDateTimeAtStartOfDay().toDate());
return cb.and(customerIsAccountOwner, accountExpiryDateBefore);
}
};
代码示例来源:origin: Activiti/Activiti
public void setValue(Object value, ValueFields valueFields) {
if (value != null) {
valueFields.setLongValue(((LocalDate) value).toDateTimeAtStartOfDay().getMillis());
} else {
valueFields.setLongValue(null);
}
}
}
代码示例来源:origin: joda-time/joda-time
/**
* Converts this object to an Interval representing the whole day.
* <p>
* The interval may have more or less than 24 hours if this is a daylight
* savings cutover date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param zone the zone to get the Interval in, null means default
* @return a interval over the day
*/
public Interval toInterval(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
DateTime start = toDateTimeAtStartOfDay(zone);
DateTime end = plusDays(1).toDateTimeAtStartOfDay(zone);
return new Interval(start, end);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Converts this object to an Interval representing the whole day.
* <p>
* The interval may have more or less than 24 hours if this is a daylight
* savings cutover date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param zone the zone to get the Interval in, null means default
* @return a interval over the day
*/
public Interval toInterval(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
DateTime start = toDateTimeAtStartOfDay(zone);
DateTime end = plusDays(1).toDateTimeAtStartOfDay(zone);
return new Interval(start, end);
}
代码示例来源:origin: joda-time/joda-time
/**
* Returns a copy of this datetime with the time set to the start of the day.
* <p>
* The time will normally be midnight, as that is the earliest time on
* any given day. However, in some time zones when Daylight Savings Time
* starts, there is no midnight because time jumps from 11:59 to 01:00.
* This method handles that situation by returning 01:00 on that date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return a copy of this datetime with the time set to the start of the day, not null
*/
public DateTime withTimeAtStartOfDay() {
return toLocalDate().toDateTimeAtStartOfDay(getZone());
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Returns a copy of this datetime with the time set to the start of the day.
* <p>
* The time will normally be midnight, as that is the earliest time on
* any given day. However, in some time zones when Daylight Savings Time
* starts, there is no midnight because time jumps from 11:59 to 01:00.
* This method handles that situation by returning 01:00 on that date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return a copy of this datetime with the time set to the start of the day, not null
*/
public DateTime withTimeAtStartOfDay() {
return toLocalDate().toDateTimeAtStartOfDay(getZone());
}
代码示例来源:origin: joda-time/joda-time
/**
* Converts this object to an Interval representing the whole month.
* <p>
* The interval will use the chronology of the year-month in the specified zone.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param zone the zone to get the Interval in, null means default
* @return an interval over the month, never null
*/
public Interval toInterval(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
return new Interval(start, end);
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Converts this object to an Interval representing the whole month.
* <p>
* The interval will use the chronology of the year-month in the specified zone.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param zone the zone to get the Interval in, null means default
* @return an interval over the month, never null
*/
public Interval toInterval(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
return new Interval(start, end);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Converts this LocalDate to a full datetime at the earliest valid time
* for the date using the default time zone.
* <p>
* The time will normally be midnight, as that is the earliest time on
* any given day. However, in some time zones when Daylight Savings Time
* starts, there is no midnight because time jumps from 11:59 to 01:00.
* This method handles that situation by returning 01:00 on that date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return this date as a datetime at the start of the day
* @since 1.5
*/
public DateTime toDateTimeAtStartOfDay() {
return toDateTimeAtStartOfDay(null);
}
代码示例来源:origin: ebean-orm/ebean
@Override
public long convertToMillis(LocalDate value) {
return value.toDateTimeAtStartOfDay().getMillis();
}
代码示例来源:origin: aaberg/sql2o
@Override
public Object toDatabaseParam(LocalDate val) {
return new java.sql.Date(val.toDateTimeAtStartOfDay().getMillis());
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Converts this object to an Interval representing the whole day.
* <p>
* The interval may have more or less than 24 hours if this is a daylight
* savings cutover date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param zone the zone to get the Interval in, null means default
* @return a interval over the day
*/
public Interval toInterval(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
DateTime start = toDateTimeAtStartOfDay(zone);
DateTime end = plusDays(1).toDateTimeAtStartOfDay(zone);
return new Interval(start, end);
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Returns a copy of this datetime with the time set to the start of the day.
* <p>
* The time will normally be midnight, as that is the earliest time on
* any given day. However, in some time zones when Daylight Savings Time
* starts, there is no midnight because time jumps from 11:59 to 01:00.
* This method handles that situation by returning 01:00 on that date.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @return a copy of this datetime with the time set to the start of the day, not null
*/
public DateTime withTimeAtStartOfDay() {
return toLocalDate().toDateTimeAtStartOfDay(getZone());
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Converts this object to an Interval representing the whole month.
* <p>
* The interval will use the chronology of the year-month in the specified zone.
* <p>
* This instance is immutable and unaffected by this method call.
*
* @param zone the zone to get the Interval in, null means default
* @return an interval over the month, never null
*/
public Interval toInterval(DateTimeZone zone) {
zone = DateTimeUtils.getZone(zone);
DateTime start = toLocalDate(1).toDateTimeAtStartOfDay(zone);
DateTime end = plusMonths(1).toLocalDate(1).toDateTimeAtStartOfDay(zone);
return new Interval(start, end);
}
内容来源于网络,如有侵权,请联系作者删除!