本文整理匯總了Java中org.joda.time.LocalDate.now方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalDate.now方法的具體用法?Java LocalDate.now怎麽用?Java LocalDate.now使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.joda.time.LocalDate
的用法示例。
在下文中一共展示了LocalDate.now方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dailyMenusMonthlyGet
import org.joda.time.LocalDate; //導入方法依賴的package包/類
/**
* @return a list to the chef, of Daily Menus of the current month
*/
@PreAuthorize("hasAuthority('chef')")
public List<DailyMenuChef> dailyMenusMonthlyGet()
{
LocalDate today = LocalDate.now();
LocalDate startOfMonth = today.dayOfMonth().withMinimumValue();
int daysOfMonth = today.dayOfMonth().withMaximumValue().getDayOfMonth();
List<DailyMenuChef> monthlyMenu = new ArrayList<>();
for (int i = 0; i < daysOfMonth; i++)
{
if (getDailyMenuChef(startOfMonth).getDate() != null)
monthlyMenu.add(getDailyMenuChef(startOfMonth));
startOfMonth = startOfMonth.plusDays(1);
}
return monthlyMenu;
}
示例2: fv
import org.joda.time.LocalDate; //導入方法依賴的package包/類
protected double fv() {
double spot = cache.marketPrices.getUnchecked(marketPriceKey).getLastPrice();
double sigma = cache.vols.getUnchecked(volKey).getValue();
double riskFreeRate = cache.intRates.getUnchecked(interestRateKey).getValue();
double strike = instrument.getStrike();
//TODO Enhancement, allow use the asOf time from ValuationRequest for asofPricing
LocalDate now = LocalDate.now();
double time = ((double) Days.daysBetween(now, LocalDate.parse(Integer.toString(instrument.getExpDate()), FORMAT)).getDays()) / DAY_IN_YEAR;
if (instrument.getOptionType() == Instrument.OptionType.P) {
return putPrice(spot, strike, riskFreeRate, sigma, time);
} else {
return callPrice(spot, strike, riskFreeRate, sigma, time);
}
}
示例3: menusWeeklyGet
import org.joda.time.LocalDate; //導入方法依賴的package包/類
@Transactional
public List<DailyMenu> menusWeeklyGet(Long userId) throws ApiException, Exception {
LocalDate today = LocalDate.now();
LocalDate firstDayOfWeek = today.minusDays(today.getDayOfWeek() - 1);
List<com.jrtechnologies.yum.api.model.DailyMenu> weeklyMenu = new ArrayList<>();
for (int i = 0; i < 7; i++) {
DailyMenu dailymenu = createWeekDailyMenu(firstDayOfWeek.plusDays(i), userId);
if (dailymenu.getDate() != null) {
weeklyMenu.add(dailymenu);
}
}
return weeklyMenu;
}
示例4: menusMonthlyGet
import org.joda.time.LocalDate; //導入方法依賴的package包/類
@Transactional
public List<DailyMenu> menusMonthlyGet(@ApiParam(value = "") @RequestParam(value = "stats", required = false) Long userId) throws ApiException, Exception {
LocalDate today = LocalDate.now();
LocalDate startOfMonth = today.dayOfMonth().withMinimumValue();
int daysOfMonth = today.dayOfMonth().withMaximumValue().getDayOfMonth();
List<DailyMenu> monthlyMenu = new ArrayList<>();
for (int i = 0; i < daysOfMonth; i++) {
DailyMenu dailymenu = createOrderedDailyMenu(startOfMonth.plusDays(i), userId);
if (dailymenu.getDate() != null) {
monthlyMenu.add(dailymenu);
}
}
return monthlyMenu;
}
示例5: init_list
import org.joda.time.LocalDate; //導入方法依賴的package包/類
private void init_list() {
moneyItemDao = dbHelper.getDaoSession().getMoneyItemDao();
input = new ArrayList<>();
LocalDate dt = new LocalDate(LocalDate.now());
recyclerView = (RecyclerView) findViewById(R.id.recyclerview_archive);
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
input = moneyItemDao.queryBuilder().where(MoneyItemDao.Properties.Date.between(new Date(0), dt.toDate())).list();
adapter = new MoneyItemAdapter(input);
recyclerView.setAdapter(adapter);
}
示例6: getStartAndEndDates
import org.joda.time.LocalDate; //導入方法依賴的package包/類
/**
* Parses ISO8601 formatted Date Strings.
* @param start If start is null then defaults to 1 month
* @param end If end is null then it defaults to now();
*/
public static Pair<LocalDate, LocalDate> getStartAndEndDates(String start, String end)
{
if (start == null) return null;
LocalDate startDate = LocalDate.parse(start);
LocalDate endDate = end!=null?LocalDate.parse(end):LocalDate.now();
return new Pair<LocalDate, LocalDate>(startDate, endDate);
}
示例7: testGetStartAndEndDates
import org.joda.time.LocalDate; //導入方法依賴的package包/類
@Test
public void testGetStartAndEndDates()
{
LocalDate currentDate = LocalDate.now();
Pair<LocalDate, LocalDate> dates = StatsGet.getStartAndEndDates(null, null);
assertNull(dates);
String test1 = "2014-05-01";
String test2 = "2015-06-30";
dates = StatsGet.getStartAndEndDates(test1, null);
assertNotNull(dates);
assertEquals(2014, dates.getFirst().getYear());
assertEquals(5, dates.getFirst().getMonthOfYear());
assertEquals(1, dates.getFirst().getDayOfMonth());
assertEquals(currentDate, dates.getSecond());
dates = StatsGet.getStartAndEndDates(null, test2);
assertNull(dates);
dates = StatsGet.getStartAndEndDates(test1, test2);
assertNotNull(dates);
assertEquals(2014, dates.getFirst().getYear());
assertEquals(5, dates.getFirst().getMonthOfYear());
assertEquals(1, dates.getFirst().getDayOfMonth());
assertNotNull(dates);
assertEquals(2015, dates.getSecond().getYear());
assertEquals(6, dates.getSecond().getMonthOfYear());
assertEquals(30, dates.getSecond().getDayOfMonth());
}