本文整理了Java中org.joda.time.DateTime.toDateMidnight()
方法的一些代码示例,展示了DateTime.toDateMidnight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateTime.toDateMidnight()
方法的具体详情如下:
包路径:org.joda.time.DateTime
类名称:DateTime
方法名:toDateMidnight
[英]Converts this object to a DateMidnight
using the same millis and chronology.
[中]使用相同的毫秒和年表将此对象转换为DateMidnight
。
代码示例来源:origin: spring-projects/spring-framework
@Override
public org.joda.time.DateMidnight convert(DateTime source) {
return source.toDateMidnight();
}
}
代码示例来源:origin: org.springframework/spring-context
@Override
public org.joda.time.DateMidnight convert(DateTime source) {
return source.toDateMidnight();
}
}
代码示例来源:origin: joda-time/joda-time
/**
* Parses a {@code DateMidnight} from the specified string using a formatter.
*
* @param str the string to parse, not null
* @param formatter the formatter to use, not null
* @since 2.0
*/
public static DateMidnight parse(String str, DateTimeFormatter formatter) {
return formatter.parseDateTime(str).toDateMidnight();
}
代码示例来源:origin: JodaOrg/joda-time
/**
* Parses a {@code DateMidnight} from the specified string using a formatter.
*
* @param str the string to parse, not null
* @param formatter the formatter to use, not null
* @since 2.0
*/
public static DateMidnight parse(String str, DateTimeFormatter formatter) {
return formatter.parseDateTime(str).toDateMidnight();
}
代码示例来源:origin: camunda/camunda-bpm-platform
/**
* Parses a {@code DateMidnight} from the specified string using a formatter.
*
* @param str the string to parse, not null
* @param formatter the formatter to use, not null
* @since 2.0
*/
public static DateMidnight parse(String str, DateTimeFormatter formatter) {
return formatter.parseDateTime(str).toDateMidnight();
}
代码示例来源:origin: org.codehaus.jackson/jackson-mapper-asl
@Override
public DateMidnight deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
// We'll accept either long (timestamp) or array:
if (jp.isExpectedStartArrayToken()) {
jp.nextToken(); // VALUE_NUMBER_INT
int year = jp.getIntValue();
jp.nextToken(); // VALUE_NUMBER_INT
int month = jp.getIntValue();
jp.nextToken(); // VALUE_NUMBER_INT
int day = jp.getIntValue();
if (jp.nextToken() != JsonToken.END_ARRAY) {
throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "after DateMidnight ints");
}
return new DateMidnight(year, month, day);
}
switch (jp.getCurrentToken()) {
case VALUE_NUMBER_INT:
return new DateMidnight(jp.getLongValue());
case VALUE_STRING:
DateTime local = parseLocal(jp);
if (local == null) {
return null;
}
return local.toDateMidnight();
}
throw ctxt.wrongTokenException(jp, JsonToken.START_ARRAY, "expected JSON Array, Number or String");
}
}
代码示例来源:origin: fearofcode/bateman
void removeDays(int i) {
DateTime first = beginningOfSeries();
DateTime midnight = first.toDateMidnight().toDateTime();
DateTime cutoff = midnight.plusDays(i);
prices = new TreeMap<DateTime, BigDecimal>(prices.tailMap(cutoff));
}
}
代码示例来源:origin: fearofcode/bateman
public DateTime closeOnDay(DateTime date) {
DateTime midnight = date.toDateMidnight().toDateTime();
DateTime nextDay = midnight.plusDays(1);
return prices.floorEntry(nextDay).getKey();
}
代码示例来源:origin: fearofcode/bateman
public BigDecimal openOnDay(DateTime date) {
DateTime midnight = date.toDateMidnight().toDateTime();
NavigableMap<DateTime, BigDecimal> previousPrices = prices.subMap(midnight, true, date, true);
return previousPrices.firstEntry().getValue();
}
代码示例来源:origin: fearofcode/bateman
@Override
public boolean buy(DateTime time, Session session) {
if (session.inMarket(time)) {
return false;
}
BigDecimal open = asset.getTimeSeries().openOnDay(time);
BigDecimal current = asset.priceAt(time);
BigDecimal increase = current.subtract(open);
final DateTime midnight = time.toDateMidnight().toDateTime();
final DateTime nextDay = midnight.plusDays(1);
boolean tradedToday = (Collections2.filter(session.getTrades(), new Predicate<Trade>() {
@Override
public boolean apply(Trade trade) {
return trade.getOpen().compareTo(midnight) > 0 && trade.getClose().compareTo(nextDay) < 0;
}
})).size() > 0;
return !tradedToday && increase.compareTo(buyTrigger) >= 0;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
/**
* Parses a {@code DateMidnight} from the specified string using a formatter.
*
* @param str the string to parse, not null
* @param formatter the formatter to use, not null
* @since 2.0
*/
public static DateMidnight parse(String str, DateTimeFormatter formatter) {
return formatter.parseDateTime(str).toDateMidnight();
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Parses a {@code DateMidnight} from the specified string using a formatter.
*
* @param str the string to parse, not null
* @param formatter the formatter to use, not null
* @since 2.0
*/
public static DateMidnight parse(String str, DateTimeFormatter formatter) {
return formatter.parseDateTime(str).toDateMidnight();
}
代码示例来源:origin: synyx/urlaubsverwaltung
public DateMidnight getAubEndDate() {
if (this.aubEndDate == null) {
return null;
}
return new DateTime(this.aubEndDate).toDateMidnight();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/**
* Parses a {@code DateMidnight} from the specified string using a formatter.
*
* @param str the string to parse, not null
* @param formatter the formatter to use, not null
* @since 2.0
*/
public static DateMidnight parse(String str, DateTimeFormatter formatter) {
return formatter.parseDateTime(str).toDateMidnight();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public DateMidnight deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException, JsonProcessingException
{
// We'll accept either long (timestamp) or array:
if (jp.isExpectedStartArrayToken()) {
jp.nextToken(); // VALUE_NUMBER_INT
int year = jp.getIntValue();
jp.nextToken(); // VALUE_NUMBER_INT
int month = jp.getIntValue();
jp.nextToken(); // VALUE_NUMBER_INT
int day = jp.getIntValue();
if (jp.nextToken() != JsonToken.END_ARRAY) {
throw ctxt.wrongTokenException(jp, JsonToken.END_ARRAY, "after DateMidnight ints");
}
return new DateMidnight(year, month, day);
}
switch (jp.getCurrentToken()) {
case VALUE_NUMBER_INT:
return new DateMidnight(jp.getLongValue());
case VALUE_STRING:
DateTime local = parseLocal(jp);
if (local == null) {
return null;
}
return local.toDateMidnight();
}
throw ctxt.wrongTokenException(jp, JsonToken.START_ARRAY, "expected JSON Array, Number or String");
}
}
代码示例来源:origin: Jasig/uPortal
@PostLoad
@PostUpdate
@PostPersist
void init() {
this.startDateMidnight = this.start.toDateMidnight();
this.endDateMidnight = this.end.toDateMidnight();
}
代码示例来源:origin: caelum/vraptor
public DateMidnight convert(String value, Class<? extends DateMidnight> type, ResourceBundle bundle) {
try {
DateTime out = new LocaleBasedJodaTimeConverter(localization).convert(value, shortDate());
if (out == null) {
return null;
}
return out.toDateMidnight();
} catch (Exception e) {
throw new ConversionError(MessageFormat.format(bundle.getString("is_not_a_valid_datetime"), value));
}
}
}
代码示例来源:origin: FenixEdu/fenixedu-academic
@Override
protected Money calculatePenaltyAmount(Event event, DateTime when, BigDecimal discountPercentage) {
if (when.toDateMidnight().compareTo(getWhenStartToApplyPenalty().toDateMidnight()) >= 0) {
return new Money(calculateMonthPenalty(event, discountPercentage).multiply(
new BigDecimal(getNumberOfMonthsToChargePenalty(when))));
} else {
return Money.ZERO;
}
}
代码示例来源:origin: org.jasig.portlet/blackboardvc-portlet-api
public void setEndTime(DateTime endTime) {
endDate = endTime.toDateMidnight();
endHour = endTime.getHourOfDay();
endMinute = endTime.getMinuteOfHour();
endHourMinute = new LocalTime(endTime);
}
代码示例来源:origin: org.randombits.supplier/supplier-core
@KeyWeight(10)
@SupplierKey("at midnight")
@API("1.0.0")
public ReadableDateTime toDateMidnight( @KeyValue ReadableDateTime dateTime ) {
return dateTime.toDateTime().toDateMidnight();
}
内容来源于网络,如有侵权,请联系作者删除!