当前位置: 首页>>代码示例>>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;未经允许,请勿转载。