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


Java JulianChronology.getInstanceUTC方法代码示例

本文整理汇总了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());
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:17,代码来源:TestIllegalFieldValueException.java

示例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;
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:20,代码来源:CdmUtils.java

示例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();
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:19,代码来源:MainTest.java

示例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));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:42,代码来源:TestDateTimeUtils.java


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