當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalDate.now方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:20,代碼來源:DailyMenuService.java

示例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);
        }
    }
 
開發者ID:alexcwyu,項目名稱:real-time-risk,代碼行數:19,代碼來源:OptionPricer.java

示例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;
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:14,代碼來源:MenusService.java

示例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;
}
 
開發者ID:jrtechnologies,項目名稱:yum,代碼行數:15,代碼來源:MenusService.java

示例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);
}
 
開發者ID:alewin,項目名稱:moneytracking,代碼行數:15,代碼來源:ArchiveActivity.java

示例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);
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:13,代碼來源:StatsGet.java

示例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());
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:30,代碼來源:StatsGetTest.java


注:本文中的org.joda.time.LocalDate.now方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。