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


Java JulianChronology.getInstance方法代码示例

本文整理汇总了Java中org.joda.time.chrono.JulianChronology.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java JulianChronology.getInstance方法的具体用法?Java JulianChronology.getInstance怎么用?Java JulianChronology.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.joda.time.chrono.JulianChronology的用法示例。


在下文中一共展示了JulianChronology.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getChronology

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
/**
 * Gets the chronology, which is the GJChronology if a GregorianCalendar is used,
 * BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise.
 * The time zone specified is used in preference to that on the calendar.
 * 
 * @param object  the Calendar to convert, must not be null
 * @param zone  the specified zone to use, null means default zone
 * @return the chronology, never null
 * @throws NullPointerException if the object is null
 * @throws ClassCastException if the object is an invalid type
 */
public Chronology getChronology(Object object, DateTimeZone zone) {
    if (object.getClass().getName().endsWith(".BuddhistCalendar")) {
        return BuddhistChronology.getInstance(zone);
    } else if (object instanceof GregorianCalendar) {
        GregorianCalendar gc = (GregorianCalendar) object;
        long cutover = gc.getGregorianChange().getTime();
        if (cutover == Long.MIN_VALUE) {
            return GregorianChronology.getInstance(zone);
        } else if (cutover == Long.MAX_VALUE) {
            return JulianChronology.getInstance(zone);
        } else {
            return GJChronology.getInstance(zone, cutover, 4);
        }
    } else {
        return ISOChronology.getInstance(zone);
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:29,代码来源:CalendarConverter.java

示例2: setUp

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    zone = DateTimeZone.getDefault();
    locale = Locale.getDefault();
    DateTimeZone.setDefault(LONDON);
    Locale.setDefault(Locale.UK);
    
    JULIAN = JulianChronology.getInstance();
    ISO = ISOChronology.getInstance();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:10,代码来源:TestStringConverter.java

示例3: setUp

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
    super.setUp();
    JULIAN = JulianChronology.getInstance();
    ISO = ISOChronology.getInstance();
    zone = DateTimeZone.getDefault();
    DateTimeZone.setDefault(PARIS);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:9,代码来源:TestReadableDurationConverter.java

示例4: setUp

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    DateTimeUtils.setCurrentMillisFixed(TEST_TIME_NOW);
    originalDateTimeZone = DateTimeZone.getDefault();
    originalTimeZone = TimeZone.getDefault();
    originalLocale = Locale.getDefault();
    DateTimeZone.setDefault(DateTimeZone.forID("Europe/London"));
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Locale.setDefault(Locale.UK);
    
    ISO = ISOChronology.getInstance();
    JULIAN = JulianChronology.getInstance();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:TestNullConverter.java

示例5: create_julian_date_instance

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
@Test
public void create_julian_date_instance () {
	
	// Battle of Megiddo
	Chronology chrono = JulianChronology.getInstance();
	DateTime dateTime = new DateTime(1457, 5, 9, 0, 0, 0, 0, chrono);

	assertNotNull(dateTime);
}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:10,代码来源:JulianCalendar.java

示例6: testConstructor_Object_Chronology

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
/**
 * Test constructor (Object, Chronology)
 */
public void testConstructor_Object_Chronology() throws Throwable {
    Date date = new Date(TEST_TIME1);
    TimeOfDay test = new TimeOfDay(date, JulianChronology.getInstance());
    assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
    assertEquals(1 + OFFSET, test.getHourOfDay());
    assertEquals(2, test.getMinuteOfHour());
    assertEquals(3, test.getSecondOfMinute());
    assertEquals(4, test.getMillisOfSecond());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:TestTimeOfDay_Constructors.java

示例7: testConstructor_Chronology

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
/**
 * Test constructor (Chronology)
 */
public void testConstructor_Chronology() throws Throwable {
    TimeOfDay test = new TimeOfDay(JulianChronology.getInstance());
    assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
    assertEquals(10 + OFFSET, test.getHourOfDay());
    assertEquals(20, test.getMinuteOfHour());
    assertEquals(30, test.getSecondOfMinute());
    assertEquals(40, test.getMillisOfSecond());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestTimeOfDay_Constructors.java

示例8: testConstructor_long1_Chronology

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
/**
 * Test constructor (long, Chronology)
 */
public void testConstructor_long1_Chronology() throws Throwable {
    TimeOfDay test = new TimeOfDay(TEST_TIME1, JulianChronology.getInstance());
    assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
    assertEquals(1 + OFFSET, test.getHourOfDay());
    assertEquals(2, test.getMinuteOfHour());
    assertEquals(3, test.getSecondOfMinute());
    assertEquals(4, test.getMillisOfSecond());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestTimeOfDay_Constructors.java

示例9: testConstructor_long2_Chronology

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
/**
 * Test constructor (long, Chronology)
 */
public void testConstructor_long2_Chronology() throws Throwable {
    TimeOfDay test = new TimeOfDay(TEST_TIME2, JulianChronology.getInstance());
    assertEquals(JulianChronology.getInstanceUTC(), test.getChronology());
    assertEquals(5 + OFFSET, test.getHourOfDay());
    assertEquals(6, test.getMinuteOfHour());
    assertEquals(7, test.getSecondOfMinute());
    assertEquals(8, test.getMillisOfSecond());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestTimeOfDay_Constructors.java

示例10: testGetDateTime6

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
public void testGetDateTime6() throws Exception {
    DateTime test = new DateTime("2004-06-09T12:24:48.501", JulianChronology.getInstance(PARIS));
    assertEquals(2004, test.getYear());
    assertEquals(6, test.getMonthOfYear());
    assertEquals(9, test.getDayOfMonth());
    assertEquals(12, test.getHourOfDay());
    assertEquals(24, test.getMinuteOfHour());
    assertEquals(48, test.getSecondOfMinute());
    assertEquals(501, test.getMillisOfSecond());
    assertEquals(PARIS, test.getZone());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:TestStringConverter.java

示例11: testGetDateTime5

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
public void testGetDateTime5() throws Exception {
    DateTime test = new DateTime("2004-06-09T12:24:48.501+02:00", JulianChronology.getInstance(PARIS));
    assertEquals(2004, test.getYear());
    assertEquals(6, test.getMonthOfYear());
    assertEquals(9, test.getDayOfMonth());
    assertEquals(12, test.getHourOfDay());
    assertEquals(24, test.getMinuteOfHour());
    assertEquals(48, test.getSecondOfMinute());
    assertEquals(501, test.getMillisOfSecond());
    assertEquals(PARIS, test.getZone());
}
 
开发者ID:gospelcoding,项目名称:versemem-android,代码行数:12,代码来源:TestStringConverter.java

示例12: JulianCalendar

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
protected JulianCalendar()
{
    super( JulianChronology.getInstance( DateTimeZone.getDefault() ) );
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:5,代码来源:JulianCalendar.java

示例13: setUp

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    JULIAN = JulianChronology.getInstance();
    ISO = ISOChronology.getInstance();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:5,代码来源:TestLongConverter.java

示例14: testGetInstantMillis_Object_Chronology

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
public void testGetInstantMillis_Object_Chronology() throws Exception {
    DateTime dt = new DateTime(2004, 6, 9, 12, 24, 48, 501, JulianChronology.getInstance(LONDON));
    assertEquals(dt.getMillis(), StringConverter.INSTANCE.getInstantMillis("2004-06-09T12:24:48.501+01:00", JULIAN));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:5,代码来源:TestStringConverter.java

示例15: setUp

import org.joda.time.chrono.JulianChronology; //导入方法依赖的package包/类
protected void setUp() throws Exception {
    JULIAN = JulianChronology.getInstance();
    ISO = ISOChronology.getInstance();
    BUDDHIST = BuddhistChronology.getInstance();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:6,代码来源:TestReadablePartialConverter.java


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