Package org.joda.time

Examples of org.joda.time.ReadablePeriod


*/
public class TimeDateUtils {

    public static String getDataNextMesi(int numeroMesi) {
        DateTime now = new DateTime();
        ReadablePeriod noUpdatePeriod = new Period().withMonths(numeroMesi);
        return now.plus(noUpdatePeriod).toString();
    }
View Full Code Here


        return now.plus(noUpdatePeriod).toString();
    }

    public static String getDataNextMesiFormattata(int numeroMesi, String regexp) {
        DateTime now = new DateTime();
        ReadablePeriod noUpdatePeriod = new Period().withMonths(numeroMesi);
        return new SimpleDateFormat(regexp).format(now.plus(noUpdatePeriod).toDate());
    }
View Full Code Here

        return new SimpleDateFormat(regexp).format(now.plus(noUpdatePeriod).toDate());
    }

    public static String getDataPreviousMesi(int numeroMesi) {
        DateTime now = new DateTime();
        ReadablePeriod noUpdatePeriod = new Period().withMonths(numeroMesi);
        return now.minus(noUpdatePeriod).toString();
    }
View Full Code Here

        return now.minus(noUpdatePeriod).toString();
    }

    public static String getDatapreviousMesiFormattata(int numeroMesi, String regexp) {
        DateTime now = new DateTime();
        ReadablePeriod noUpdatePeriod = new Period().withMonths(numeroMesi);
        return new SimpleDateFormat(regexp).format(now.minus(noUpdatePeriod).toDate());
    }
View Full Code Here

   *         Milliseconds (data type Long)
   */
  public ReadablePeriod getDuration() {
    final DateTime startingTime = getStartingTime();
    final DateTime finishingTime = getFinishingTime();
    ReadablePeriod duration = null;
    if (startingTime == null || finishingTime == null) {
      duration = new Period();
    } else {
      Interval intervallTime = new Interval(startingTime, finishingTime);
      duration = intervallTime.toPeriod();
View Full Code Here

            return true;
        }
        if (period instanceof ReadablePeriod == false) {
            return false;
        }
        ReadablePeriod other = (ReadablePeriod) period;
        return (other.getPeriodType() == getPeriodType() && other.getValue(0) == getValue());
    }
View Full Code Here

     * @return the period type from the readable duration
     * @throws NullPointerException if the object is null
     * @throws ClassCastException if the object is an invalid type
     */
    public PeriodType getPeriodType(Object object) {
        ReadablePeriod period = (ReadablePeriod) object;
        return period.getPeriodType();
    }
View Full Code Here

            return true;
        }
        if (period instanceof ReadablePeriod == false) {
            return false;
        }
        ReadablePeriod other = (ReadablePeriod) period;
        if (size() != other.size()) {
            return false;
        }
        for (int i = 0, isize = size(); i < isize; i++) {
            if (getValue(i) != other.getValue(i) || getFieldType(i) != other.getFieldType(i)) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

  }

  @Override
  protected AggregateCountsResource instantiateResource(AggregateCount entity) {
    AggregateCountsResource result = new AggregateCountsResource(entity.getName());
    ReadablePeriod increment = entity.getResolution().unitPeriod;
    DateTime end = entity.getInterval().getEnd();
    int i = 0;
    for (DateTime when = entity.getInterval().getStart(); !when.isAfter(end); when = when.plus(increment)) {
      result.addValue(new Date(when.getMillis()), entity.getCounts()[i++]);
    }
View Full Code Here

{

  public void testDeserializeSeconds() throws Exception
  {
    ObjectMapper objectMapper = jodaMapper();
    ReadablePeriod readablePeriod = objectMapper.readValue( "{\"fieldType\":{\"name\":\"seconds\"},\"seconds\":12,\"periodType\":{\"name\":\"Seconds\"}}", ReadablePeriod.class );
    assertNotNull( readablePeriod );
    assertEquals( Seconds.seconds( 12 ), readablePeriod );
  }
View Full Code Here

TOP

Related Classes of org.joda.time.ReadablePeriod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.