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


Java DateTime.getDayOfMonth方法代碼示例

本文整理匯總了Java中org.joda.time.DateTime.getDayOfMonth方法的典型用法代碼示例。如果您正苦於以下問題:Java DateTime.getDayOfMonth方法的具體用法?Java DateTime.getDayOfMonth怎麽用?Java DateTime.getDayOfMonth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.joda.time.DateTime的用法示例。


在下文中一共展示了DateTime.getDayOfMonth方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateNewUploadId

import org.joda.time.DateTime; //導入方法依賴的package包/類
/**
 * Creates a new uploadId from the time:
 * format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);
 * @return
 */
public static String generateNewUploadId() {
    java.util.Date juDate = new Date();
    DateTime dt = new DateTime(juDate);

    StringBuilder sb = new StringBuilder();
    // Send all output to the Appendable object sb
    Formatter formatter = new Formatter(sb);


    int day = dt.getDayOfMonth();
    int month = dt.getMonthOfYear();
    int year = dt.getYear();
    int hour = dt.getHourOfDay();
    int minute = dt.getMinuteOfHour();
    int seconds = dt.getSecondOfMinute();

    formatter.format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);
    return sb.toString();

}
 
開發者ID:UMM-CSci-3601-S17,項目名稱:digital-display-garden-iteration-4-revolverenguardia-1,代碼行數:26,代碼來源:ExcelParser.java

示例2: checkAndConvertDate

import org.joda.time.DateTime; //導入方法依賴的package包/類
protected static final DateTime checkAndConvertDate(final String dateString, final boolean hideErrors) {
    DateTime dateToReturn = new DateTime();
    try {
        dateToReturn =  new DateTime().parse(dateString);

        if(!hideErrors && (dateString.length() != 10 || dateToReturn.getYear() <= 0 ||
           dateToReturn.getMonthOfYear() <= 0 || dateToReturn.getDayOfMonth() <= 0)) {
            throw new IllegalArgumentException();
        }

    } catch(IllegalArgumentException e) {
        if(!hideErrors) { e.printStackTrace(); }
        dateToReturn = null;
    }
    return dateToReturn;
}
 
開發者ID:ricomaster9000,項目名稱:sageOneApiLibrary-GLOBAL,代碼行數:17,代碼來源:SageOneApiTemplateMainImpl.java

示例3: getAvailableUploadId

import org.joda.time.DateTime; //導入方法依賴的package包/類
public static String getAvailableUploadId(){

        StringBuilder sb = new StringBuilder();
        // Send all output to the Appendable object sb
        Formatter formatter = new Formatter(sb);

        java.util.Date juDate = new Date();
        DateTime dt = new DateTime(juDate);

        int day = dt.getDayOfMonth();
        int month = dt.getMonthOfYear();
        int year = dt.getYear();
        int hour = dt.getHourOfDay();
        int minute = dt.getMinuteOfHour();
        int seconds = dt.getSecondOfMinute();

        formatter.format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);
        return sb.toString();

    }
 
開發者ID:UMM-CSci-3601-S17,項目名稱:digital-display-garden-iteration-3-sixguysburgers-fries,代碼行數:21,代碼來源:ImageHandler.java

示例4: getAvailableUploadId

import org.joda.time.DateTime; //導入方法依賴的package包/類
public static String getAvailableUploadId(){

        StringBuilder sb = new StringBuilder();
        // Send all output to the Appendable object sb
        Formatter formatter = new Formatter(sb);

        java.util.Date juDate = new Date();
        DateTime dt = new DateTime(juDate);

        int day = dt.getDayOfMonth();
        int month = dt.getMonthOfYear();
        int year = dt.getYear();
        int hour = dt.getHourOfDay();
        int minute = dt.getMinuteOfHour();
        int seconds = dt.getSecondOfMinute();

        formatter.format("%d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, seconds);

        allIds.add(sb.toString());
        return sb.toString();
    }
 
開發者ID:UMM-CSci-3601-S17,項目名稱:digital-display-garden-iteration-3-sixguysburgers-fries,代碼行數:22,代碼來源:ExcelParser.java

示例5: incrementSageOneRequestCounter

import org.joda.time.DateTime; //導入方法依賴的package包/類
static boolean incrementSageOneRequestCounter(final int companyId) {
    boolean response = true;
    SageOneConstants.SAGE_ONE_REQUEST_COUNTER_DAY.put(companyId, SageOneConstants.SAGE_ONE_REQUEST_COUNTER_DAY.get(companyId) + 1);
    SageOneConstants.SAGE_ONE_REQUEST_COUNTER_HOUR.put(companyId, SageOneConstants.SAGE_ONE_REQUEST_COUNTER_HOUR.get(companyId) + 1);
    DateTime now = new DateTime();

    if((SageOneConstants.SAGE_ONE_REQUEST_COUNTER_DAY.get(companyId) >= SageOneConstants.SAGE_ONE_REQUEST_LIMIT_DAY &&
            SageOneConstants.CURRENT_DAY == now.getDayOfMonth())
            || (SageOneConstants.SAGE_ONE_REQUEST_COUNTER_HOUR.get(companyId) >= SageOneConstants.SAGE_ONE_REQUEST_LIMIT_HOUR &&
            SageOneConstants.CURRENT_HOUR == now.getHourOfDay())) {
        response = false;
        resultLimitReached = true;
    }

    if(SageOneConstants.CURRENT_DAY != now.getDayOfMonth()) {
        SageOneConstants.CURRENT_DAY = now.getDayOfMonth();
        SageOneConstants.SAGE_ONE_REQUEST_COUNTER_DAY.put(companyId, 0);
    }

    if(SageOneConstants.CURRENT_HOUR != now.getHourOfDay()) {
        SageOneConstants.CURRENT_HOUR = now.getHourOfDay();
        SageOneConstants.SAGE_ONE_REQUEST_COUNTER_HOUR.put(companyId, 0);
    }
    return response;
}
 
開發者ID:ricomaster9000,項目名稱:sageOneApiLibrary-GLOBAL,代碼行數:26,代碼來源:SageOneCoreConnection.java

示例6: getDateIdFromTimestamp

import org.joda.time.DateTime; //導入方法依賴的package包/類
public static int getDateIdFromTimestamp(long millis) {
	int result;
	DateTime dt = new DateTime(millis, DateTimeZone.UTC);
	int year = dt.getYear();
	int month = dt.getMonthOfYear();
	int day = dt.getDayOfMonth();
	result = day + (100 * month) + (10000 * year);
	return result;
}
 
開發者ID:GoogleCloudPlatform,項目名稱:dataflow-opinion-analysis,代碼行數:10,代碼來源:IndexerPipelineUtils.java

示例7: getFirstDayOfMonth

import org.joda.time.DateTime; //導入方法依賴的package包/類
/**
 * 獲取某一天所在月的第一天
 * 
 * @param date
 * @return
 */
public static Date getFirstDayOfMonth(Date date) {
	DateTime dateTime = new DateTime(date.getTime());
	int dayOfMonth = dateTime.getDayOfMonth();
	DateTime firstDate = dateTime.minusDays(dayOfMonth - 1);
	firstDate = firstDate.withTime(0, 0, 0, 0);
	return firstDate.toDate();

}
 
開發者ID:alamby,項目名稱:upgradeToy,代碼行數:15,代碼來源:DateUtils.java

示例8: getStartSinceDay

import org.joda.time.DateTime; //導入方法依賴的package包/類
private static final DateTime getStartSinceDay(int days) {
  DateTime utcNow = new DateTime(DateTimeZone.UTC);
  DateTime
      today =
      new DateTime(utcNow.getYear(), utcNow.getMonthOfYear(), utcNow.getDayOfMonth(), 0, 0, 0,
          DateTimeZone.UTC);
  return today.minusDays(days);
}
 
開發者ID:pinterest,項目名稱:soundwave,代碼行數:9,代碼來源:EsInstanceStore.java

示例9: computeStandardTotalPrice

import org.joda.time.DateTime; //導入方法依賴的package包/類
@JsonIgnore
public void computeStandardTotalPrice() {

    DateTime dtBegin = new DateTime(begin);
    DateTime dtEnd = new DateTime(end);
    DateTime dayBegin = new DateTime(dtBegin.getYear(), dtBegin.getMonthOfYear(), dtBegin.getDayOfMonth(), 0, 0, 0);
    DateTime dayEnd = new DateTime(dtEnd.getYear(), dtEnd.getMonthOfYear(), dtEnd.getDayOfMonth(), 0, 0, 0);

    Duration duration = new Duration(dayBegin, dayEnd);
    double price = getAccommodation().getPricePerDay() * duration.getStandardDays();
    totalPrice = Math.round(price * 100) / 100;
}
 
開發者ID:remipassmoilesel,項目名稱:simple-hostel-management,代碼行數:13,代碼來源:Reservation.java

示例10: parseTime

import org.joda.time.DateTime; //導入方法依賴的package包/類
/**
 * 解析API傳回的時間 XXXX-XX-XX 的字符串, 轉換為中文指代的時間, 比如 "今天 02/09"
 */
public static String parseTime(String timeText){
    DateTime dateTime = new DateTime();
    String[] time = timeText.split("-");

    int currentMonth = dateTime.getMonthOfYear();
    int currentDay = dateTime.getDayOfMonth();
    int currentWeak = dateTime.getDayOfWeek();
    int currentYear = dateTime.getYear();

    int month = Integer.parseInt(time[1]);
    int day = Integer.parseInt(time[2]);
    int year = Integer.parseInt(time[0]);

    int offset = 0;  // 相差量

    if (year == currentYear){
        //如果是同一年:
        if (month == currentMonth){
            // 如果是同一個月
            offset = day - currentDay;

        }else{
            offset = day + parseMonth(currentMonth, currentYear) - currentDay;
        }

    }else{
        offset = 31 - currentDay + day;
    }



    String monthAndDay = time[1] + "/" + time[2];
    if (offset == 0) return "今天 " + monthAndDay;
    if (offset == 1) return  "明天 " + monthAndDay;
    return parseWeak(currentWeak + offset) + " " + monthAndDay;

}
 
開發者ID:LynnYuki,項目名稱:CoolCloud-Weather,代碼行數:41,代碼來源:Time.java

示例11: formatDate

import org.joda.time.DateTime; //導入方法依賴的package包/類
private String formatDate (DateTime beg, DateTime end) {
    if (beg.getYear() != end.getYear())
        return longFormat.print(beg) + "-" + longFormat.print(end);
    if (beg.getMonthOfYear() != end.getMonthOfYear())
        return medFormat.print(beg) + "-" + medFormat.print(end) + ", " + beg
                .getYear();
    return shortFormat.print(beg) + " " + beg.getDayOfMonth() + "-" +
            end.getDayOfMonth() + ", " + beg.getYear();

}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:11,代碼來源:TripMapFragment.java

示例12: onCreateDialog

import org.joda.time.DateTime; //導入方法依賴的package包/類
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    DateTime selectedDate = model.getSelectedDateTime();
    return new DatePickerDialog(getActivity(), listener, selectedDate.getYear(), selectedDate.getMonthOfYear(), selectedDate.getDayOfMonth());
}
 
開發者ID:IMSmobile,項目名稱:Fahrplan,代碼行數:6,代碼來源:DatePickerFragment.java

示例13: formatted

import org.joda.time.DateTime; //導入方法依賴的package包/類
private String formatted(DateTime d) {
    return d.monthOfYear().getAsShortText(Locale.getDefault()) + " " +
            d.getDayOfMonth() + ", " + d.getYear();
}
 
開發者ID:gvsucis,項目名稱:mobile-app-dev-book,代碼行數:5,代碼來源:TripEditorActivity.java

示例14: getDay

import org.joda.time.DateTime; //導入方法依賴的package包/類
/**
 * 獲取date對象天數
 * @param date
 * @return
 */
public static int getDay(Date date) {
	DateTime dt = new DateTime(date);
	return dt.getDayOfMonth();
}
 
開發者ID:huang-up,項目名稱:mycat-src-1.6.1-RELEASE,代碼行數:10,代碼來源:DateUtil.java

示例15: getDay

import org.joda.time.DateTime; //導入方法依賴的package包/類
/**
 * getDay
 *
 * @param date
 * @return
 */
public static int getDay(Date date) {
    DateTime dt = new DateTime(date);
    return dt.getDayOfMonth();
}
 
開發者ID:actiontech,項目名稱:dble,代碼行數:11,代碼來源:DateUtil.java


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