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


Java ISOChronology.getInstance方法代码示例

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


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

示例1: getChronology

import org.joda.time.chrono.ISOChronology; //导入方法依赖的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: AgeCalculator

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
public AgeCalculator() {
    super();

    iChronology = ISOChronology.getInstance();
    iBirthdateStr = "1970-01-01T00:00:00";

    setTitle("Age Calculator");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    addMainArea(getContentPane());
    addNotify();
    Dimension size = getPreferredSize();
    setSize(size);
    Dimension screenSize = getToolkit().getScreenSize();
    setLocation(screenSize.width / 2 - size.width / 2,
                screenSize.height / 2 - size.height / 2);

    iTimer = new Timer(500, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateResults();
        }
    });

    iTimer.setInitialDelay(0);
    iTimer.start();
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:26,代码来源:AgeCalculator.java

示例3: weeksInYear

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
@Override
public int weeksInYear( int year )
{
    DateTime dateTime = new DateTime( year, 1, 1, 0, 0,
        ISOChronology.getInstance( DateTimeZone.getDefault() ) );
    return dateTime.weekOfWeekyear().getMaximumValue();
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:8,代码来源:PersianCalendar.java

示例4: getInstantChronology

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
/**
 * Gets the chronology from the specified instant object handling null.
 * <p>
 * If the instant object is <code>null</code>, or the instant's chronology is
 * <code>null</code>, {@link ISOChronology#getInstance()} will be returned.
 * Otherwise, the chronology from the object is returned.
 * 
 * @param instant  the instant to examine, null means ISO in the default zone
 * @return the chronology, never null
 */
public static final Chronology getInstantChronology(ReadableInstant instant) {
    if (instant == null) {
        return ISOChronology.getInstance();
    }
    Chronology chrono = instant.getChronology();
    if (chrono == null) {
        return ISOChronology.getInstance();
    }
    return chrono;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:21,代码来源:DateTimeUtils.java

示例5: BaseInterval

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
/**
 * Constructs an interval from a start and end instant.
 * 
 * @param start  start of this interval, null means now
 * @param end  end of this interval, null means now
 * @throws IllegalArgumentException if the end is before the start
 */
protected BaseInterval(ReadableInstant start, ReadableInstant end) {
    super();
    if (start == null && end == null) {
        iStartMillis = iEndMillis = DateTimeUtils.currentTimeMillis();
        iChronology = ISOChronology.getInstance();
    } else {
        iChronology = DateTimeUtils.getInstantChronology(start);
        iStartMillis = DateTimeUtils.getInstantMillis(start);
        iEndMillis = DateTimeUtils.getInstantMillis(end);
        checkInterval(iStartMillis, iEndMillis);
    }
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:20,代码来源:BaseInterval.java

示例6: getChronology

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
/**
 * Gets the chronology, which is taken from the ReadableInstant.
 * If the chronology on the instant is null, the ISOChronology in the
 * specified time zone is used.
 * If the chronology on the instant is not in the specified zone, it is
 * adapted.
 * 
 * @param object  the ReadableInstant to convert, must not be null
 * @param zone  the specified zone to use, null means default zone
 * @return the chronology, never null
 */
public Chronology getChronology(Object object, DateTimeZone zone) {
    Chronology chrono = ((ReadableInstant) object).getChronology();
    if (chrono == null) {
        return ISOChronology.getInstance(zone);
    }
    DateTimeZone chronoZone = chrono.getZone();
    if (chronoZone != zone) {
        chrono = chrono.withZone(zone);
        if (chrono == null) {
            return ISOChronology.getInstance(zone);
        }
    }
    return chrono;
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:26,代码来源:ReadableInstantConverter.java

示例7: testDateMidnight

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public void testDateMidnight() {
    DateMidnight test = new DateMidnight(2010, 6, 30, ISOChronology.getInstance(ZONE));
    String str = StringConvert.INSTANCE.convertToString(test);
    assertEquals("2010-06-30T00:00:00.000+02:00", str);
    assertEquals(test, StringConvert.INSTANCE.convertFromString(DateMidnight.class, str));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:TestStringConvert.java

示例8: setUp

import org.joda.time.chrono.ISOChronology; //导入方法依赖的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

示例9: testParse_noFormatter

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
public void testParse_noFormatter() throws Throwable {
    DateTime start = new DateTime(2010, 6, 30, 12, 30, ISOChronology.getInstance(PARIS));
    DateTime end = new DateTime(2010, 7, 1, 14, 30, ISOChronology.getInstance(PARIS));
    assertEquals(new MutableInterval(start, end), MutableInterval.parse("2010-06-30T12:30/2010-07-01T14:30"));
    assertEquals(new MutableInterval(start, end), MutableInterval.parse("2010-06-30T12:30/P1DT2H"));
    assertEquals(new MutableInterval(start, end), MutableInterval.parse("P1DT2H/2010-07-01T14:30"));
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:TestMutableInterval_Constructors.java

示例10: testMonthNames_monthEnd

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
public void testMonthNames_monthEnd() {
    DateTimeFormatter printer = DateTimeFormat.forPattern("MMMM");
    for (int i=0; i<ZONES.length; i++) {
        Chronology chrono = ISOChronology.getInstance(ZONES[i]);
        for (int month=1; month<=12; month++) {
            DateTime dt = new DateTime(2004, month, 1, 23, 20, 30, 40, chrono);
            int lastDay = chrono.dayOfMonth().getMaximumValue(dt.getMillis());
            dt = new DateTime(2004, month, lastDay, 23, 20, 30, 40, chrono);
            String monthText = printer.print(dt);
            assertEquals(MONTHS[month], monthText);
        }
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:TestTextFields.java

示例11: Iso8601Calendar

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

示例12: weeksInYear

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
@Override
public int weeksInYear( int year )
{
    DateTime dateTime = new DateTime( year, 1, 1, 0, 0, ISOChronology.getInstance( DateTimeZone.getDefault() ) );
    return dateTime.weekOfWeekyear().getMaximumValue();
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:7,代码来源:NepaliCalendar.java

示例13: testFormatDateTimeOffsetyyyyMMddHHmmss

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
@Test
public void testFormatDateTimeOffsetyyyyMMddHHmmss() {
  Chronology c = ISOChronology.getInstance(DateTimeZone.forOffsetHours(1));
  DateTime dt = new DateTime(2010, 12, 20, 17, 34, 5, 0, c);
  Assert.assertEquals("2010-12-20T17:34:05+01:00", InternalUtil.formatDateTimeOffsetForXml(dt));
}
 
开发者ID:teiid,项目名称:oreva,代码行数:7,代码来源:DateTimeFormatTest.java

示例14: testFormatDateTimeOffsetyyyyMMddHHmmssfffffff

import org.joda.time.chrono.ISOChronology; //导入方法依赖的package包/类
@Test
public void testFormatDateTimeOffsetyyyyMMddHHmmssfffffff() {
  Chronology c = ISOChronology.getInstance(DateTimeZone.forOffsetHours(1));
  DateTime dt = new DateTime(2010, 12, 20, 17, 34, 5, 123, c);
  Assert.assertEquals("2010-12-20T17:34:05.123+01:00", InternalUtil.formatDateTimeOffsetForXml(dt));
}
 
开发者ID:teiid,项目名称:oreva,代码行数:7,代码来源:DateTimeFormatTest.java

示例15: setUp

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


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