本文整理汇总了Java中org.joda.time.Weeks.weeksBetween方法的典型用法代码示例。如果您正苦于以下问题:Java Weeks.weeksBetween方法的具体用法?Java Weeks.weeksBetween怎么用?Java Weeks.weeksBetween使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.Weeks
的用法示例。
在下文中一共展示了Weeks.weeksBetween方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storeAllMeasures
import org.joda.time.Weeks; //导入方法依赖的package包/类
/**
* Obtain the indicators from the statistics and stores them into the im
*
* @param im indicatorMap to store the indicators
* @param statistics statistics of the git.
*/
private void storeAllMeasures(IndicatorsMap im, GitLogStatistics statistics)
{
DateTime dt = new DateTime(statistics.firstCommitDate);
Months months = Months.monthsBetween(dt, new DateTime());
Weeks weeks = Weeks.weeksBetween(dt, new DateTime());
im.add("git average-commits-per-month", (double) statistics.totalCommits / months.getMonths());
im.add("git average-commits-per-week", (double) statistics.totalCommits / weeks.getWeeks());
im.add("git average-commits-per-committer", (double) statistics.totalCommits / statistics.totalCommitters);
im.add("git average-files-changed-per-committer", (double) statistics.totalFilesChanged
/ statistics.totalCommitters);
im.add("git average-lines-added-per-commmit", (double) statistics.totalLinesAdded / statistics.totalCommits);
im.add("git average-lines-removed-per-commit", (double) statistics.totalLinesRemoved / statistics.totalCommits);
im.add("git average-files-changed-per-commit", (double) statistics.totalFilesChanged / statistics.totalCommits);
im.add("git distribution-commits-by-hour", RiskDataType.DISTRIBUTION,
getDistribution(statistics.commitsByHour, statistics.totalCommits));
im.add("git distribution-commits-by-weekday", RiskDataType.DISTRIBUTION,
getDistribution(statistics.commitsByWeekday, statistics.totalCommits));
}
示例2: onCreate
import org.joda.time.Weeks; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_knell);
ButterKnife.bind(this);
Birthday birthday = getBirthdayManager().get();
DateTime birDateTime = new DateTime(birthday.year, birthday.month, birthday.day, 0, 0);
Days days = Days.daysBetween(birDateTime, DateTime.now());
Hours hours = Hours.hoursBetween(birDateTime, DateTime.now());
Minutes minutes = Minutes.minutesBetween(birDateTime, DateTime.now());
Weeks weeks = Weeks.weeksBetween(birDateTime, DateTime.now());
Years years = Years.yearsBetween(birDateTime, DateTime.now());
Months months = Months.monthsBetween(birDateTime, DateTime.now());
Timber.d("onCreate: 年:%d", years.getYears());
Timber.d("onCreate: 月:%d", months.getMonths());
Timber.d("onCreate: 周:%d", weeks.getWeeks());
Timber.d("onCreate: 天数为:%d", days.getDays());
Timber.d("onCreate: 小时数为:%d", hours.getHours());
Timber.d("onCreate: 分钟数为:%d", minutes.getMinutes());
tvYear.setText(String.valueOf(years.getYears()));
tvMonth.setText(String.valueOf(months.getMonths()));
tvWeek.setText(String.valueOf(weeks.getWeeks()));
tvDay.setText(String.valueOf(days.getDays()));
tvHour.setText(String.valueOf(hours.getHours()));
tvMinute.setText(String.valueOf(minutes.getMinutes()));
}
示例3: getDeltaSinceEpoch
import org.joda.time.Weeks; //导入方法依赖的package包/类
public static int getDeltaSinceEpoch(int time, int tempRes) {
int delta = 0;
// Epoch
MutableDateTime epoch = new MutableDateTime();
epoch.setDate(0);
DateTime dt = new DateTime(time*1000, DateTimeZone.UTC);
switch(tempRes) {
case FrameworkUtils.HOUR:
Hours hours = Hours.hoursBetween(epoch, dt);
delta = hours.getHours();
break;
case FrameworkUtils.DAY:
Days days = Days.daysBetween(epoch, dt);
delta = days.getDays();
break;
case FrameworkUtils.WEEK:
Weeks weeks = Weeks.weeksBetween(epoch, dt);
delta = weeks.getWeeks();
break;
case FrameworkUtils.MONTH:
Months months = Months.monthsBetween(epoch, dt);
delta = months.getMonths();
break;
case FrameworkUtils.YEAR:
Years years = Years.yearsBetween(epoch, dt);
delta = years.getYears();
break;
default:
hours = Hours.hoursBetween(epoch, dt);
delta = hours.getHours();
break;
}
return delta;
}
示例4: matchesSchedule
import org.joda.time.Weeks; //导入方法依赖的package包/类
private boolean matchesSchedule(Calendar firstDate, Calendar testDate) {
DateMidnight dmFirst = new DateMidnight(firstDate.getTimeInMillis());
DateMidnight dmTest = new DateMidnight(testDate.getTimeInMillis());
Weeks weeks = Weeks.weeksBetween(dmFirst, dmTest);
if (0 != weeks.getWeeks() % frequency) {
return false;
}
int dow = testDate.get(Calendar.DAY_OF_WEEK);
int dayIndex = ((dow - Calendar.SUNDAY) + 6) % 7;
return occurrs[dayIndex];
}
示例5: weeks_between_two_dates_in_java_with_joda
import org.joda.time.Weeks; //导入方法依赖的package包/类
@Test
public void weeks_between_two_dates_in_java_with_joda () {
DateTime start = new DateTime(2005, 1, 1, 0, 0, 0, 0);
DateTime end = new DateTime(2006, 1, 1, 0, 0, 0, 0);
Weeks weeks = Weeks.weeksBetween(start, end);
int weeksInYear = weeks.getWeeks();
assertEquals(52, weeksInYear);
}