Java 8 Temporal - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Temporal class.

This code example shows how to use the following methods:toString
    public void serialize(T value, JsonGenerator generator, SerializerProvider provider) throws IOException
    { 
        if (useTimestamp(provider)) {
            if (provider.isEnabled(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)) {
                generator.writeNumber(DecimalUtils.toBigDecimal(
                        getEpochSeconds.applyAsLong(value), getNanoseconds.applyAsInt(value)
                )); 
                return; 
            } 
            generator.writeNumber(getEpochMillis.applyAsLong(value));
            return; 
        } 
        String str;
         
        if (_formatter != null) {
            str = _formatter.format(value);;
        } else if (defaultFormat != null) {
            str = defaultFormat.format(value);;
        } else { 
            str = value.toString();

6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get
    private static final class NormaliseNanosAdjuster implements TemporalAdjuster {
 
        public LocalTime adjustInto(Temporal time) {
            if (time == null) { return null; }
 
            int millis = (int) (time.get(ChronoField.NANO_OF_SECOND) / 1000000);
 
            return LocalTime.of(time.get(ChronoField.HOUR_OF_DAY), time.get(ChronoField.MINUTE_OF_HOUR), time.get(ChronoField.SECOND_OF_MINUTE), millis * 1000000);
        } 
    } 
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get
    private static final class NormaliseNanosAdjuster implements TemporalAdjuster {
 
        public LocalTime adjustInto(Temporal time) {
            if (time == null) { return null; }
 
            int millis = (int) (time.get(ChronoField.NANO_OF_SECOND) / 1000000);
 
            return LocalTime.of(time.get(ChronoField.HOUR_OF_DAY), time.get(ChronoField.MINUTE_OF_HOUR), time.get(ChronoField.SECOND_OF_MINUTE), millis * 1000000);
        } 
    } 
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:plus, get
    private static enum Adjuster implements TemporalAdjuster {
        /** Next working day adjuster. */ 
        NEXT_WORKING {
            @Override 
            public Temporal adjustInto(Temporal temporal) {
                int dow = temporal.get(DAY_OF_WEEK); 
                switch (dow) { 
                    case 6:  // Saturday 
                        return temporal.plus(2, DAYS); 
                    case 5:  // Friday 
                        return temporal.plus(3, DAYS); 
                    default: 
                        return temporal.plus(1, DAYS); 
                } 
            } 
        }, 
        /** Previous working day adjuster. */ 
        PREVIOUS_WORKING {
            @Override 
            public Temporal adjustInto(Temporal temporal) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:get
    private static final class NormaliseNanosAdjuster implements TemporalAdjuster {
 
        public LocalTime adjustInto(Temporal time) {
            if (time == null) { return null; }
 
            int millis = (int) (time.get(ChronoField.NANO_OF_SECOND) / 1000000);
 
            return LocalTime.of(time.get(ChronoField.HOUR_OF_DAY), time.get(ChronoField.MINUTE_OF_HOUR), time.get(ChronoField.SECOND_OF_MINUTE), millis * 1000000);
        } 
    } 
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 Temporal Methods: