本文整理汇总了Java中org.joda.time.base.BaseSingleFieldPeriod.standardPeriodIn方法的典型用法代码示例。如果您正苦于以下问题:Java BaseSingleFieldPeriod.standardPeriodIn方法的具体用法?Java BaseSingleFieldPeriod.standardPeriodIn怎么用?Java BaseSingleFieldPeriod.standardPeriodIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.base.BaseSingleFieldPeriod
的用法示例。
在下文中一共展示了BaseSingleFieldPeriod.standardPeriodIn方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: standardPeriodIn
import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
public static int standardPeriodIn(ReadablePeriod period, long millisPerUnit) {
return BaseSingleFieldPeriod.standardPeriodIn(period, millisPerUnit);
}
示例2: standardMinutesIn
import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
* Creates a new <code>Minutes</code> representing the number of complete
* standard length minutes in the specified period.
* <p>
* This factory method converts all fields from the period to minutes using standardised
* durations for each field. Only those fields which have a precise duration in
* the ISO UTC chronology can be converted.
* <ul>
* <li>One week consists of 7 days.
* <li>One day consists of 24 hours.
* <li>One hour consists of 60 minutes.
* <li>One minute consists of 60 seconds.
* <li>One second consists of 1000 milliseconds.
* </ul>
* Months and Years are imprecise and periods containing these values cannot be converted.
*
* @param period the period to get the number of minutes from, null returns zero
* @return the period in minutes
* @throws IllegalArgumentException if the period contains imprecise duration values
*/
public static Minutes standardMinutesIn(ReadablePeriod period) {
int amount = BaseSingleFieldPeriod.standardPeriodIn(period, DateTimeConstants.MILLIS_PER_MINUTE);
return Minutes.minutes(amount);
}
示例3: standardWeeksIn
import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
* Creates a new <code>Weeks</code> representing the number of complete
* standard length weeks in the specified period.
* <p>
* This factory method converts all fields from the period to hours using standardised
* durations for each field. Only those fields which have a precise duration in
* the ISO UTC chronology can be converted.
* <ul>
* <li>One week consists of 7 days.
* <li>One day consists of 24 hours.
* <li>One hour consists of 60 minutes.
* <li>One minute consists of 60 weeks.
* <li>One second consists of 1000 milliseconds.
* </ul>
* Months and Years are imprecise and periods containing these values cannot be converted.
*
* @param period the period to get the number of hours from, null returns zero
* @return the period in weeks
* @throws IllegalArgumentException if the period contains imprecise duration values
*/
public static Weeks standardWeeksIn(ReadablePeriod period) {
int amount = BaseSingleFieldPeriod.standardPeriodIn(period, DateTimeConstants.MILLIS_PER_WEEK);
return Weeks.weeks(amount);
}
示例4: standardSecondsIn
import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
* Creates a new <code>Seconds</code> representing the number of complete
* standard length seconds in the specified period.
* <p>
* This factory method converts all fields from the period to hours using standardised
* durations for each field. Only those fields which have a precise duration in
* the ISO UTC chronology can be converted.
* <ul>
* <li>One week consists of 7 seconds.
* <li>One day consists of 24 hours.
* <li>One hour consists of 60 minutes.
* <li>One minute consists of 60 seconds.
* <li>One second consists of 1000 milliseconds.
* </ul>
* Months and Years are imprecise and periods containing these values cannot be converted.
*
* @param period the period to get the number of hours from, null returns zero
* @return the period in seconds
* @throws IllegalArgumentException if the period contains imprecise duration values
*/
public static Seconds standardSecondsIn(ReadablePeriod period) {
int amount = BaseSingleFieldPeriod.standardPeriodIn(period, DateTimeConstants.MILLIS_PER_SECOND);
return Seconds.seconds(amount);
}
示例5: standardDaysIn
import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
* Creates a new <code>Days</code> representing the number of complete
* standard length days in the specified period.
* <p>
* This factory method converts all fields from the period to hours using standardised
* durations for each field. Only those fields which have a precise duration in
* the ISO UTC chronology can be converted.
* <ul>
* <li>One week consists of 7 days.
* <li>One day consists of 24 hours.
* <li>One hour consists of 60 minutes.
* <li>One minute consists of 60 seconds.
* <li>One second consists of 1000 milliseconds.
* </ul>
* Months and Years are imprecise and periods containing these values cannot be converted.
*
* @param period the period to get the number of hours from, null returns zero
* @return the period in days
* @throws IllegalArgumentException if the period contains imprecise duration values
*/
public static Days standardDaysIn(ReadablePeriod period) {
int amount = BaseSingleFieldPeriod.standardPeriodIn(period, DateTimeConstants.MILLIS_PER_DAY);
return Days.days(amount);
}
示例6: standardHoursIn
import org.joda.time.base.BaseSingleFieldPeriod; //导入方法依赖的package包/类
/**
* Creates a new <code>Hours</code> representing the number of complete
* standard length hours in the specified period.
* <p>
* This factory method converts all fields from the period to hours using standardised
* durations for each field. Only those fields which have a precise duration in
* the ISO UTC chronology can be converted.
* <ul>
* <li>One week consists of 7 days.
* <li>One day consists of 24 hours.
* <li>One hour consists of 60 minutes.
* <li>One minute consists of 60 seconds.
* <li>One second consists of 1000 milliseconds.
* </ul>
* Months and Years are imprecise and periods containing these values cannot be converted.
*
* @param period the period to get the number of hours from, null returns zero
* @return the period in hours
* @throws IllegalArgumentException if the period contains imprecise duration values
*/
public static Hours standardHoursIn(ReadablePeriod period) {
int amount = BaseSingleFieldPeriod.standardPeriodIn(period, DateTimeConstants.MILLIS_PER_HOUR);
return Hours.hours(amount);
}