当前位置: 首页>>代码示例>>Java>>正文


Java ReadableDateTime类代码示例

本文整理汇总了Java中org.joda.time.ReadableDateTime的典型用法代码示例。如果您正苦于以下问题:Java ReadableDateTime类的具体用法?Java ReadableDateTime怎么用?Java ReadableDateTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ReadableDateTime类属于org.joda.time包,在下文中一共展示了ReadableDateTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: AggregateKeyGenerator

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
public AggregateKeyGenerator(String repoPrefix, String counterName, ReadableDateTime dateTime) {
	Assert.notNull(counterName, "Counter name name can not be null");
	Assert.notNull(dateTime, "DateTime can not be null");
	this.repoPrefix = repoPrefix;
	this.counterName = counterName;
	String timeStamp = dateTimeFormatter.print(dateTime);
	totalKey = key("total");
	hourKey = key(timeStamp.substring(0, 10));
	dayKey = key(timeStamp.substring(0, 8));
	monthKey = key(timeStamp.substring(0, 6));
	yearKey = key(timeStamp.substring(0, 4));
	yearsKey = key("years");

	minute = timeStamp.substring(10, 12);
	hour = timeStamp.substring(8, 10);
	day = timeStamp.substring(6, 8);
	month = timeStamp.substring(4, 6);
	year = timeStamp.substring(0, 4);
}
 
开发者ID:spring-projects,项目名称:spring-analytics,代码行数:20,代码来源:AggregateKeyGenerator.java

示例2: setTimeOnly

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
/**
 * Set the value to a time only.
 *
 * @param t a time only
 * @param millis if true set milliseconds, otherwise do not set milliseconds
 */
public void setTimeOnly(ReadableDateTime t, boolean millis) {
    setDigits(t.getHourOfDay(), 2, 0);
    bytes[2] = ':';
    setDigits(t.getMinuteOfHour(), 2, 3);
    bytes[5] = ':';
    setDigits(t.getSecondOfMinute(), 2, 6);

    if (millis) {
        bytes[8] = '.';
        setDigits(t.getMillisOfSecond(), 3, 9);
        bytes[12] = SOH;

        length = 12;
    } else {
        bytes[8] = SOH;

        length = 8;
    }

    offset = 0;
}
 
开发者ID:paritytrading,项目名称:philadelphia,代码行数:28,代码来源:FIXValue.java

示例3: setTimestamp

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
/**
 * Set the value to a timestamp.
 *
 * @param t a timestamp
 * @param millis if true set milliseconds, otherwise do not set milliseconds
 */
public void setTimestamp(ReadableDateTime t, boolean millis) {
    setDigits(t.getYear(), 4, 0);
    setDigits(t.getMonthOfYear(), 2, 4);
    setDigits(t.getDayOfMonth(), 2, 6);
    bytes[8] = '-';
    setDigits(t.getHourOfDay(), 2, 9);
    bytes[11] = ':';
    setDigits(t.getMinuteOfHour(), 2, 12);
    bytes[14] = ':';
    setDigits(t.getSecondOfMinute(), 2, 15);

    if (millis) {
        bytes[17] = '.';
        setDigits(t.getMillisOfSecond(), 3, 18);
        bytes[21] = SOH;

        length = 21;
    } else {
        bytes[17] = SOH;

        length = 17;
    }

    offset = 0;
}
 
开发者ID:paritytrading,项目名称:philadelphia,代码行数:32,代码来源:FIXValue.java

示例4: getInstance

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
/**
 * Wraps another chronology, with datetime limits. When withUTC or
 * withZone is called, the returned LimitChronology instance has
 * the same limits, except they are time zone adjusted.
 *
 * @param base  base chronology to wrap
 * @param lowerLimit  inclusive lower limit, or null if none
 * @param upperLimit  exclusive upper limit, or null if none
 * @throws IllegalArgumentException if chronology is null or limits are invalid
 */
public static LimitChronology getInstance(Chronology base,
                                          ReadableDateTime lowerLimit,
                                          ReadableDateTime upperLimit) {
    if (base == null) {
        throw new IllegalArgumentException("Must supply a chronology");
    }

    lowerLimit = lowerLimit == null ? null : lowerLimit.toDateTime();
    upperLimit = upperLimit == null ? null : upperLimit.toDateTime();

    if (lowerLimit != null && upperLimit != null) {
        if (!lowerLimit.isBefore(upperLimit)) {
            throw new IllegalArgumentException
                ("The lower limit must be come before than the upper limit");
        }
    }

    return new LimitChronology(base, (DateTime)lowerLimit, (DateTime)upperLimit);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:30,代码来源:LimitChronology.java

示例5: testBigHashtable

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
public void testBigHashtable() {
    Converter[] array = new Converter[] {
        c1, c2, c3, c4,
    };
    ConverterSet set = new ConverterSet(array);
    set.select(Boolean.class);
    set.select(Character.class);
    set.select(Byte.class);
    set.select(Short.class);
    set.select(Integer.class);
    set.select(Long.class);
    set.select(Float.class);
    set.select(Double.class);
    set.select(null);
    set.select(Calendar.class);
    set.select(GregorianCalendar.class);
    set.select(DateTime.class);
    set.select(DateMidnight.class);
    set.select(ReadableInstant.class);
    set.select(ReadableDateTime.class);
    set.select(ReadWritableInstant.class);  // 16
    set.select(ReadWritableDateTime.class);
    set.select(DateTime.class);
    assertEquals(4, set.size());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:26,代码来源:TestConverterSet.java

示例6: deserialize

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public ReadableDateTime deserialize(JsonParser jp, DeserializationContext ctxt)
        throws IOException
{
    JsonToken t = jp.getCurrentToken();
    if (t == JsonToken.VALUE_STRING) {
        String str = jp.getText().trim();
        if (str.length() == 0) { // [JACKSON-360]
            return null;
        }
        // always use the tz in the string

        return ISODateTimeFormat.dateTime().withOffsetParsed().parseDateTime(str);
    }
    // TODO: in 2.4, use 'handledType()'
    throw ctxt.mappingException(getValueClass());
}
 
开发者ID:ohmage,项目名称:lifestreams,代码行数:19,代码来源:DateTimeSerializeModule.java

示例7: parseDeparture

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
private Departure parseDeparture(Attributes attributes, ReadableDateTime time) {
    Departure.Builder departure = Departure.newBuilder();
    departure.setName(attributes.getValue(XML_DEPARTURE_NAME));

    // As no time zone is given, assume the one from the parameter
    String xmlDate = attributes.getValue(XML_DEPARTURE_DATE);
    String xmlTime = attributes.getValue(XML_DEPARTURE_TIME);
    LocalDateTime localTime = DATE_TIME_FORMATTER.parseLocalDateTime(xmlDate + xmlTime);
    departure.setTime(localTime.toDateTime(time.getZone()));

    String xmlDirection = attributes.getValue(XML_DEPARTURE_DIRECTION);
    if (xmlDirection != null) {
        departure.setDirection(xmlDirection);
    }
    return departure.build();
}
 
开发者ID:markuswustenberg,项目名称:naestebus,代码行数:17,代码来源:RejseplanDataSupplier.java

示例8: DateObjectValueSource

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
DateObjectValueSource(IndexFieldData<?> indexFieldData, MultiValueMode multiValueMode, 
                      String methodName, ToIntFunction<ReadableDateTime> function) {
    super(indexFieldData, multiValueMode);

    Objects.requireNonNull(methodName);

    this.methodName = methodName;
    this.function = function;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:DateObjectValueSource.java

示例9: getDate

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
@Deprecated
public ReadableDateTime getDate() {
    deprecationLogger.deprecated("getDate on numeric fields is deprecated. Use a date field to get dates.");
    if (dates == null) {
        dates = new Dates(values);
        dates.refreshArray();
    }
    return dates.getValue();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:ScriptDocValues.java

示例10: getDates

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
@Deprecated
public List<ReadableDateTime> getDates() {
    deprecationLogger.deprecated("getDates on numeric fields is deprecated. Use a date field to get dates.");
    if (dates == null) {
        dates = new Dates(values);
        dates.refreshArray();
    }
    return dates;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:ScriptDocValues.java

示例11: getValue

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
/**
 * Fetch the first field value or 0 millis after epoch if there are no values.
 */
public ReadableDateTime getValue() {
    if (values.count() == 0) {
        return EPOCH;
    }
    return get(0);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:ScriptDocValues.java

示例12: get

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
@Override
public ReadableDateTime get(int index) {
    if (index >= values.count()) {
        throw new IndexOutOfBoundsException(
                "attempted to fetch the [" + index + "] date when there are only [" + values.count() + "] dates.");
    }
    return dates[index];
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:ScriptDocValues.java

示例13: setDate

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
/**
 * Set the value to a date.
 *
 * @param d a date
 */
public void setDate(ReadableDateTime d) {
    setDigits(d.getYear(), 4, 0);
    setDigits(d.getMonthOfYear(), 2, 4);
    setDigits(d.getDayOfMonth(), 2, 6);
    bytes[8] = SOH;

    length = 8;
    offset = 0;
}
 
开发者ID:paritytrading,项目名称:philadelphia,代码行数:15,代码来源:FIXValue.java

示例14: append

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
/**
 * Append a timestamp to a string builder.
 *
 * @param t a timestamp
 * @param s a string builder
 */
public static void append(ReadableDateTime t, StringBuilder s) {
    s.append(t.getYear());
    appendTwoDigits(t.getMonthOfYear(), s);
    appendTwoDigits(t.getDayOfMonth(), s);
    s.append('-');
    appendTwoDigits(t.getHourOfDay(), s);
    s.append(':');
    appendTwoDigits(t.getMinuteOfHour(), s);
    s.append(':');
    appendTwoDigits(t.getSecondOfMinute(), s);
    s.append('.');
    appendThreeDigits(t.getMillisOfSecond(), s);
}
 
开发者ID:paritytrading,项目名称:philadelphia,代码行数:20,代码来源:FIXTimestamps.java

示例15: valueOf

import org.joda.time.ReadableDateTime; //导入依赖的package包/类
public static FDate valueOf(final ReadableDateTime jodaTime) {
    if (jodaTime != null) {
        return new FDate(jodaTime);
    } else {
        return null;
    }
}
 
开发者ID:subes,项目名称:invesdwin-util,代码行数:8,代码来源:FDate.java


注:本文中的org.joda.time.ReadableDateTime类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。