本文整理汇总了Java中org.joda.time.chrono.JulianChronology.getInstanceUTC方法的典型用法代码示例。如果您正苦于以下问题:Java JulianChronology.getInstanceUTC方法的具体用法?Java JulianChronology.getInstanceUTC怎么用?Java JulianChronology.getInstanceUTC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.chrono.JulianChronology
的用法示例。
在下文中一共展示了JulianChronology.getInstanceUTC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testJulianYearZero
import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
public void testJulianYearZero() {
DateTime dt = new DateTime(JulianChronology.getInstanceUTC());
try {
dt.year().setCopy(0);
fail();
} catch (IllegalFieldValueException e) {
assertEquals(DateTimeFieldType.year(), e.getDateTimeFieldType());
assertEquals(null, e.getDurationFieldType());
assertEquals("year", e.getFieldName());
assertEquals(new Integer(0), e.getIllegalNumberValue());
assertEquals(null, e.getIllegalStringValue());
assertEquals("0", e.getIllegalValueAsString());
assertEquals(null, e.getLowerBound());
assertEquals(null, e.getUpperBound());
}
}
示例2: getChronologyForString
import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
private static Chronology getChronologyForString(String chronologyString) {
if (chronologyString == null || "gregorian".equalsIgnoreCase(chronologyString)
|| "standard".equalsIgnoreCase(chronologyString)) {
return ISOChronology.getInstanceUTC();
} else if ("proleptic_gregorian".equalsIgnoreCase(chronologyString)) {
return GregorianChronology.getInstanceUTC();
} else if ("julian".equalsIgnoreCase(chronologyString)) {
return JulianChronology.getInstanceUTC();
} else if ("noleap".equalsIgnoreCase(chronologyString)
|| "365_day".equalsIgnoreCase(chronologyString)) {
return NoLeapChronology.getInstanceUTC();
} else if ("all_leap".equalsIgnoreCase(chronologyString)
|| "366_day".equalsIgnoreCase(chronologyString)) {
return AllLeapChronology.getInstanceUTC();
} else if ("360_day".equalsIgnoreCase(chronologyString)) {
return ThreeSixtyDayChronology.getInstanceUTC();
}
return null;
}
示例3: MainTest
import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
/**
* @param iterations number of test iterations to perform
* @param mode GREGORIAN_MODE or JULIAN_MODE,0=Gregorian, 1=Julian
* @param seed seed for random number generator
*/
public MainTest(int iterations, int mode, long seed) {
super("testChronology");
iIterations = iterations;
iMode = mode;
iSeed = seed;
if (mode == GREGORIAN_MODE) {
iTest = new TestGregorianChronology();
iActual = GregorianChronology.getInstanceUTC();
} else {
iTest = new TestJulianChronology();
iActual = JulianChronology.getInstanceUTC();
}
}
示例4: test_julianDay
import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
public void test_julianDay() {
DateTime base = new DateTime(1970, 1, 1, 0, 0, DateTimeZone.UTC);
assertEquals(2440587.5d, DateTimeUtils.toJulianDay(base.getMillis()), 0.0001d);
assertEquals(2440588, DateTimeUtils.toJulianDayNumber(base.getMillis()));
assertEquals(base.getMillis(), DateTimeUtils.fromJulianDay(2440587.5d));
base = base.plusHours(6);
assertEquals(2440587.75d, DateTimeUtils.toJulianDay(base.getMillis()), 0.0001d);
assertEquals(2440588, DateTimeUtils.toJulianDayNumber(base.getMillis()));
assertEquals(base.getMillis(), DateTimeUtils.fromJulianDay(2440587.75d));
base = base.plusHours(6);
assertEquals(2440588d, DateTimeUtils.toJulianDay(base.getMillis()), 0.0001d);
assertEquals(2440588, DateTimeUtils.toJulianDayNumber(base.getMillis()));
assertEquals(base.getMillis(), DateTimeUtils.fromJulianDay(2440588d));
base = base.plusHours(6);
assertEquals(2440588.25d, DateTimeUtils.toJulianDay(base.getMillis()), 0.0001d);
assertEquals(2440588, DateTimeUtils.toJulianDayNumber(base.getMillis()));
assertEquals(base.getMillis(), DateTimeUtils.fromJulianDay(2440588.25d));
base = base.plusHours(6);
assertEquals(2440588.5d, DateTimeUtils.toJulianDay(base.getMillis()), 0.0001d);
assertEquals(2440589, DateTimeUtils.toJulianDayNumber(base.getMillis()));
assertEquals(base.getMillis(), DateTimeUtils.fromJulianDay(2440588.5d));
base = new DateTime(2012, 8, 31, 23, 50, DateTimeZone.UTC);
assertEquals(2456171.4930555555, DateTimeUtils.toJulianDay(base.getMillis()), 0.0001d);
assertEquals(2456171, DateTimeUtils.toJulianDayNumber(base.getMillis()));
base = new DateTime(-4713, 1, 1, 12, 0, JulianChronology.getInstanceUTC());
assertEquals(0d, DateTimeUtils.toJulianDay(base.getMillis()), 0.0001d);
assertEquals(0, DateTimeUtils.toJulianDayNumber(base.getMillis()));
assertEquals(base.getMillis(), DateTimeUtils.fromJulianDay(0d));
base = new DateTime(-4713, 1, 1, 0, 0, JulianChronology.getInstanceUTC());
assertEquals(-0.5d, DateTimeUtils.toJulianDay(base.getMillis()), 0.0001d);
assertEquals(0, DateTimeUtils.toJulianDayNumber(base.getMillis()));
assertEquals(base.getMillis(), DateTimeUtils.fromJulianDay(-0.5d));
}