Package com.google.ical.values

Examples of com.google.ical.values.DateTimeValue


   * @param zone Timezone against which epochSecs applies
   * @return Number of milliseconds since 00:00:00 Jan 1, 1970 GMT
   */
  private static long timetMillisFromEpochSecs(long epochSecs,
                                               TimeZone zone) {
    DateTimeValue date = timeFromSecsSinceEpoch(epochSecs);
    Calendar cal = new GregorianCalendar(zone);
    cal.clear(); // clear millis
    cal.setTimeZone(zone);
    cal.set(date.year(), date.month() - 1, date.day(),
            date.hour(), date.minute(), date.second());
    return cal.getTimeInMillis();
  }
View Full Code Here


    int minutesInDay = secsInDay / 60;
    int minute = minutesInDay % 60;
    int hour = minutesInDay / 60;
    if (!(hour >= 0 && hour < 24)) throw new AssertionError(
        "Input was: " + secsSinceEpoch + "to make hour: " + hour);
    DateTimeValue result =
      new DateTimeValueImpl(year, month, day, hour, minute, second);
    // assert result.equals(normalize(result));
    // assert secsSinceEpoch(result) == secsSinceEpoch;
    return result;
  }
View Full Code Here

                 DateTimeIteratorFactory.dateTimeToDateValue(
                     dateTime(2006, 10, 13, 12, 30, 1)));
  }

  public void testConsistency() throws Exception {
    DateTimeValue dtv = new DateTimeValueImpl(2006, 10, 13, 12, 30, 1);
    assertEquals(dtv, DateTimeIteratorFactory.dateTimeToDateValue(
                     DateTimeIteratorFactory.dateValueToDateTime(dtv)));
  }
View Full Code Here

    }
  }

  public void testDurationConstructor() throws Exception {
    final DateValue DV = new DateValueImpl(2005, 2, 15);
    final DateTimeValue DTV0 = new DateTimeValueImpl(2005, 2, 15, 0, 0, 0),
      DTV12 = new DateTimeValueImpl(2005, 2, 15, 12, 0, 0);
    DateValue ONE_DAY = new DateValueImpl(0, 0, 1),
      YESTERDAY = new DateValueImpl(0, 0, -1),
      ONE_WEEK = new DateValueImpl(0, 0, 7),
      ONE_MONTH = new DateValueImpl(0, 1, 0),
      ONE_YEAR = new DateValueImpl(1, 0, 0);
    DateTimeValue ONE_HOUR = new DateTimeValueImpl(0, 0, 0, 1, 0, 0),
      TWELVE_HOURS = new DateTimeValueImpl(0, 0, 0, 12, 0, 0),
      SAME_TIME = new DateTimeValueImpl(0, 0, 0, 0, 0, 0);

    assertEquals(PeriodValueImpl.create(DV, new DateValueImpl(2005, 2, 16)),
                 PeriodValueImpl.createFromDuration(DV, ONE_DAY));
View Full Code Here

TOP

Related Classes of com.google.ical.values.DateTimeValue

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.