org.joda.time.LocalDate.toDateMidnight()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.joda.time.LocalDate.toDateMidnight()方法的一些代码示例,展示了LocalDate.toDateMidnight()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocalDate.toDateMidnight()方法的具体详情如下:
包路径:org.joda.time.LocalDate
类名称:LocalDate
方法名:toDateMidnight

LocalDate.toDateMidnight介绍

[英]Converts this LocalDate to a DateMidnight in the default time zone.

As from v1.5, you are recommended to avoid DateMidnight and use #toDateTimeAtStartOfDay() instead because of the exception detailed below.

This method will throw an exception if the default time zone switches to Daylight Savings Time at midnight and this LocalDate represents that switchover date. The problem is that there is no such time as midnight on the required date, and as such an exception is thrown.

This instance is immutable and unaffected by this method call.
[中]将此LocalDate转换为默认时区中的DateMidnight。
从v1开始。5.建议您避免DateMidnight,并使用#toDateTimeAtStartOfDay()代替,因为下面详细介绍了例外情况。
如果默认时区在午夜切换为夏令时,并且此LocalDate表示切换日期,则此方法将引发异常。问题是在所需日期没有午夜这样的时间,因此会引发异常。
此实例是不可变的,不受此方法调用的影响。

代码示例

代码示例来源:origin: joda-time/joda-time

/**
 * Converts this LocalDate to a DateMidnight in the default time zone.
 * <p>
 * As from v1.5, you are recommended to avoid DateMidnight and use
 * {@link #toDateTimeAtStartOfDay()} instead because of the exception
 * detailed below.
 * <p>
 * This method will throw an exception if the default time zone switches
 * to Daylight Savings Time at midnight and this LocalDate represents
 * that switchover date. The problem is that there is no such time as
 * midnight on the required date, and as such an exception is thrown.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return the DateMidnight instance in the default zone
 * @deprecated DateMidnight is deprecated
 */
@Deprecated
public DateMidnight toDateMidnight() {
  return toDateMidnight(null);
}

代码示例来源:origin: JodaOrg/joda-time

/**
 * Converts this LocalDate to a DateMidnight in the default time zone.
 * <p>
 * As from v1.5, you are recommended to avoid DateMidnight and use
 * {@link #toDateTimeAtStartOfDay()} instead because of the exception
 * detailed below.
 * <p>
 * This method will throw an exception if the default time zone switches
 * to Daylight Savings Time at midnight and this LocalDate represents
 * that switchover date. The problem is that there is no such time as
 * midnight on the required date, and as such an exception is thrown.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return the DateMidnight instance in the default zone
 * @deprecated DateMidnight is deprecated
 */
@Deprecated
public DateMidnight toDateMidnight() {
  return toDateMidnight(null);
}

代码示例来源:origin: prestodb/presto

return 12.34;
case "bound_date":
  return new LocalDate(2001, 8, 22).toDateMidnight(DateTimeZone.UTC).getMillis();
case "bound_time":
  return new LocalTime(3, 4, 5, 321).toDateTime(new DateTime(0, DateTimeZone.UTC)).getMillis();

代码示例来源:origin: opentripplanner/OpenTripPlanner

rr.dateTime = request.date.toDateMidnight(DateTimeZone.forTimeZone(graph.getTimeZone())).getMillis() / 1000 +
    request.fromTime;
rr.walkSpeed = request.walkSpeed;

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Converts this LocalDate to a DateMidnight in the default time zone.
 * <p>
 * As from v1.5, you are recommended to avoid DateMidnight and use
 * {@link #toDateTimeAtStartOfDay()} instead because of the exception
 * detailed below.
 * <p>
 * This method will throw an exception if the default time zone switches
 * to Daylight Savings Time at midnight and this LocalDate represents
 * that switchover date. The problem is that there is no such time as
 * midnight on the required date, and as such an exception is thrown.
 * <p>
 * This instance is immutable and unaffected by this method call.
 *
 * @return the DateMidnight instance in the default zone
 */
public DateMidnight toDateMidnight() {
  return toDateMidnight(null);
}

代码示例来源:origin: com.fasterxml.jackson.datatype/jackson-datatype-joda

return null;
  return local.toDateMidnight();
default:

代码示例来源:origin: Jasig/uPortal

@Override
public DateMidnight getDate() {
  DateMidnight dm = this.dateMidnight;
  if (dm == null) {
    dm = this.date.toDateMidnight();
    this.dateMidnight = dm;
  }
  return dm;
}

代码示例来源:origin: fenix-framework/fenix-framework

private String mekeQueryString() {
  return "select left(SERVER, locate(':', SERVER) - 1), NUM_READS, NUM_WRITES, NUM_ABORTS, NUM_CONFLICTS, STATS_WHEN from FF$TRANSACTION_STATISTICS "
      + "where STATS_WHEN >='"
      + dateTimeFormatter.print(startOfReport.toDateMidnight())
      + "' and STATS_WHEN < '"
      + dateTimeFormatter.print(endOfReport.toDateMidnight()) + "'";
}

代码示例来源:origin: com.amazon.carbonado/carbonado

public long adaptToLong(LocalDate date) {
  if (date != null) {
    return date.toDateMidnight(mZone).getMillis();
  }
  throw new IllegalArgumentException
    ("Cannot adapt null date into long for property \"" +
     mPropertyName + '"');
}

代码示例来源:origin: com.jpattern/jporm-core

@Override
public Timestamp unWrap(final LocalDate value) {
  if (value==null) {
    return null;
  }
  return new Timestamp(value.toDateMidnight().getMillis());
}

代码示例来源:origin: Carbonado/Carbonado

public long adaptToLong(LocalDate date) {
  if (date != null) {
    return date.toDateMidnight(mZone).getMillis();
  }
  throw new IllegalArgumentException
    ("Cannot adapt null date into long for property \"" +
     mPropertyName + '"');
}

代码示例来源:origin: com.jpattern/jporm-api

@Override
public Timestamp unWrap(final LocalDate value) {
  if (value==null) {
    return null;
  }
  return new Timestamp(value.toDateMidnight().getMillis());
}

代码示例来源:origin: FenixEdu/fenixedu-academic

@Override
protected boolean isToFire() {
  int days = Days.daysBetween(calculateStartDate().toDateMidnight(), new LocalDate().toDateMidnight()).getDays();
  return days >= INTERVAL;
}

代码示例来源:origin: FenixEdu/fenixedu-academic

@Override
protected boolean isToFire() {
  int days = Days.daysBetween(calculateStartDate().toDateMidnight(), new LocalDate().toDateMidnight()).getDays();
  return days >= INTERVAL;
}

代码示例来源:origin: FenixEdu/fenixedu-academic

@Override
protected boolean isToFire() {
  int days = Days.daysBetween(calculateStartDate().toDateMidnight(), new LocalDate().toDateMidnight()).getDays();
  return days >= INTERVAL;
}

代码示例来源:origin: org.avaje.ebeanorm/avaje-ebeanorm-server

public Object toJdbcType(Object value) {
  if (value instanceof LocalDate){
    return new java.sql.Date(((LocalDate)value).toDateMidnight().getMillis());
  }
  return BasicTypeConverter.toDate(value);
}

代码示例来源:origin: org.avaje/ebean

public Object toJdbcType(Object value) {
  if (value instanceof LocalDate){
    return new java.sql.Date(((LocalDate)value).toDateMidnight().getMillis());
  }
  return BasicTypeConverter.toDate(value);
}

代码示例来源:origin: FenixEdu/fenixedu-academic

public static Interval getInterval(LocalDate startDate, LocalDate endDate) {
  long start = startDate == null ? Long.MIN_VALUE : startDate.toDateMidnight().getMillis();
  long end = endDate == null ? Long.MAX_VALUE : endDate.toDateMidnight().toDateTime().withTime(23, 59, 59, 999).getMillis();
  return new Interval(start, end);
}

代码示例来源:origin: FenixEdu/fenixedu-academic

public EventPaymentCode(Person creator, LocalDate startDate, LocalDate endDate, Money minAmount, Money
    maxAmount) {
  init(PaymentCodeType.EVENT, startDate.toDateMidnight().toYearMonthDay(), endDate.toDateTimeAtMidnight().toYearMonthDay(), minAmount,
      maxAmount, creator);
}

代码示例来源:origin: FenixEdu/fenixedu-academic

public DateTime getEndDateBeforeMidnight() {
    if (getEndDate() == null) {
      return null;
    }

    return getEndDate().plusDays(1).toDateMidnight().toDateTime().minusSeconds(1);
  }
}

相关文章