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


Java BaseSingleFieldPeriod.between方法代码示例

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


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

示例1: between

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
public static int between(ReadableInstant start, ReadableInstant end, DurationFieldType field) {
    return BaseSingleFieldPeriod.between(start, end, field);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:4,代码来源:TestBaseSingleFieldPeriod.java

示例2: minutesBetween

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Minutes</code> representing the number of whole minutes
 * between the two specified partial datetimes.
 * <p>
 * The two partials must contain the same fields, for example you can specify
 * two <code>LocalTime</code> objects.
 *
 * @param start  the start partial date, must not be null
 * @param end  the end partial date, must not be null
 * @return the period in minutes
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Minutes minutesBetween(ReadablePartial start, ReadablePartial end) {
    if (start instanceof LocalTime && end instanceof LocalTime)   {
        Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
        int minutes = chrono.minutes().getDifference(
                ((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis());
        return Minutes.minutes(minutes);
    }
    int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
    return Minutes.minutes(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:23,代码来源:Minutes.java

示例3: yearsIn

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Years</code> representing the number of whole years
 * in the specified interval. This method corectly handles any daylight
 * savings time changes that may occur during the interval.
 *
 * @param interval  the interval to extract years from, null returns zero
 * @return the period in years
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Years yearsIn(ReadableInterval interval) {
    if (interval == null)   {
        return Years.ZERO;
    }
    int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.years());
    return Years.years(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:17,代码来源:Years.java

示例4: weeksBetween

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Weeks</code> representing the number of whole weeks
 * between the two specified partial datetimes.
 * <p>
 * The two partials must contain the same fields, for example you can specify
 * two <code>LocalDate</code> objects.
 *
 * @param start  the start partial date, must not be null
 * @param end  the end partial date, must not be null
 * @return the period in weeks
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Weeks weeksBetween(ReadablePartial start, ReadablePartial end) {
    if (start instanceof LocalDate && end instanceof LocalDate)   {
        Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
        int weeks = chrono.weeks().getDifference(
                ((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis());
        return Weeks.weeks(weeks);
    }
    int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
    return Weeks.weeks(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:23,代码来源:Weeks.java

示例5: weeksIn

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Weeks</code> representing the number of whole weeks
 * in the specified interval.
 *
 * @param interval  the interval to extract weeks from, null returns zero
 * @return the period in weeks
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Weeks weeksIn(ReadableInterval interval) {
    if (interval == null)   {
        return Weeks.ZERO;
    }
    int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.weeks());
    return Weeks.weeks(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:16,代码来源:Weeks.java

示例6: secondsBetween

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Seconds</code> representing the number of whole seconds
 * between the two specified partial datetimes.
 * <p>
 * The two partials must contain the same fields, for example you can specify
 * two <code>LocalTime</code> objects.
 *
 * @param start  the start partial date, must not be null
 * @param end  the end partial date, must not be null
 * @return the period in seconds
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Seconds secondsBetween(ReadablePartial start, ReadablePartial end) {
    if (start instanceof LocalTime && end instanceof LocalTime)   {
        Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
        int seconds = chrono.seconds().getDifference(
                ((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis());
        return Seconds.seconds(seconds);
    }
    int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
    return Seconds.seconds(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:23,代码来源:Seconds.java

示例7: secondsIn

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Seconds</code> representing the number of whole seconds
 * in the specified interval.
 *
 * @param interval  the interval to extract seconds from, null returns zero
 * @return the period in seconds
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Seconds secondsIn(ReadableInterval interval) {
    if (interval == null)   {
        return Seconds.ZERO;
    }
    int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.seconds());
    return Seconds.seconds(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:16,代码来源:Seconds.java

示例8: daysBetween

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Days</code> representing the number of whole days
 * between the two specified partial datetimes.
 * <p>
 * The two partials must contain the same fields, for example you can specify
 * two <code>LocalDate</code> objects.
 *
 * @param start  the start partial date, must not be null
 * @param end  the end partial date, must not be null
 * @return the period in days
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Days daysBetween(ReadablePartial start, ReadablePartial end) {
    if (start instanceof LocalDate && end instanceof LocalDate)   {
        Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
        int days = chrono.days().getDifference(
                ((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis());
        return Days.days(days);
    }
    int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
    return Days.days(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:23,代码来源:Days.java

示例9: daysIn

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Days</code> representing the number of whole days
 * in the specified interval. This method corectly handles any daylight
 * savings time changes that may occur during the interval.
 *
 * @param interval  the interval to extract days from, null returns zero
 * @return the period in days
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Days daysIn(ReadableInterval interval) {
    if (interval == null)   {
        return Days.ZERO;
    }
    int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.days());
    return Days.days(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:17,代码来源:Days.java

示例10: monthsBetween

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Months</code> representing the number of whole months
 * between the two specified partial datetimes.
 * <p>
 * The two partials must contain the same fields, for example you can specify
 * two <code>LocalDate</code> objects.
 *
 * @param start  the start partial date, must not be null
 * @param end  the end partial date, must not be null
 * @return the period in months
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Months monthsBetween(ReadablePartial start, ReadablePartial end) {
    if (start instanceof LocalDate && end instanceof LocalDate)   {
        Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
        int months = chrono.months().getDifference(
                ((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis());
        return Months.months(months);
    }
    int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
    return Months.months(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:23,代码来源:Months.java

示例11: monthsIn

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Months</code> representing the number of whole months
 * in the specified interval. This method corectly handles any daylight
 * savings time changes that may occur during the interval.
 *
 * @param interval  the interval to extract months from, null returns zero
 * @return the period in months
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Months monthsIn(ReadableInterval interval) {
    if (interval == null)   {
        return Months.ZERO;
    }
    int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.months());
    return Months.months(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:17,代码来源:Months.java

示例12: hoursBetween

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Hours</code> representing the number of whole hours
 * between the two specified partial datetimes.
 * <p>
 * The two partials must contain the same fields, for example you can specify
 * two <code>LocalTime</code> objects.
 *
 * @param start  the start partial date, must not be null
 * @param end  the end partial date, must not be null
 * @return the period in hours
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Hours hoursBetween(ReadablePartial start, ReadablePartial end) {
    if (start instanceof LocalTime && end instanceof LocalTime)   {
        Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
        int hours = chrono.hours().getDifference(
                ((LocalTime) end).getLocalMillis(), ((LocalTime) start).getLocalMillis());
        return Hours.hours(hours);
    }
    int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
    return Hours.hours(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:23,代码来源:Hours.java

示例13: hoursIn

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Hours</code> representing the number of whole hours
 * in the specified interval.
 *
 * @param interval  the interval to extract hours from, null returns zero
 * @return the period in hours
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Hours hoursIn(ReadableInterval interval) {
    if (interval == null)   {
        return Hours.ZERO;
    }
    int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.hours());
    return Hours.hours(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:16,代码来源:Hours.java

示例14: yearsBetween

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Years</code> representing the number of whole years
 * between the two specified partial datetimes.
 * <p>
 * The two partials must contain the same fields, for example you can specify
 * two <code>LocalDate</code> objects.
 *
 * @param start  the start partial date, must not be null
 * @param end  the end partial date, must not be null
 * @return the period in years
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Years yearsBetween(ReadablePartial start, ReadablePartial end) {
    if (start instanceof LocalDate && end instanceof LocalDate)   {
        Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
        int years = chrono.years().getDifference(
                ((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis());
        return Years.years(years);
    }
    int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
    return Years.years(amount);
}
 
开发者ID:redfish64,项目名称:TinyTravelTracker,代码行数:23,代码来源:Years.java

示例15: minutesIn

import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
 * Creates a <code>Minutes</code> representing the number of whole minutes
 * in the specified interval.
 *
 * @param interval  the interval to extract minutes from, null returns zero
 * @return the period in minutes
 * @throws IllegalArgumentException if the partials are null or invalid
 */
public static Minutes minutesIn(ReadableInterval interval) {
    if (interval == null)   {
        return Minutes.ZERO;
    }
    int amount = BaseSingleFieldPeriod.between(interval.getStart(), interval.getEnd(), DurationFieldType.minutes());
    return Minutes.minutes(amount);
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:16,代码来源:Minutes.java


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