当前位置: 首页>>代码示例>>Java>>正文


Java DateTime.today方法代码示例

本文整理汇总了Java中hirondelle.date4j.DateTime.today方法的典型用法代码示例。如果您正苦于以下问题:Java DateTime.today方法的具体用法?Java DateTime.today怎么用?Java DateTime.today使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在hirondelle.date4j.DateTime的用法示例。


在下文中一共展示了DateTime.today方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onNewIntent

import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
    if (intent.hasExtra(NotifySchedulingService.NOTIFICATION_WORN)) {
        //TODO: save date in intent so that we can retrieve whether it still applies for the current date
        DateTime utcDateTime = DateTime.today(TimeZone.getTimeZone("UTC"));
        long utcDateLong = utcDateTime.getMilliseconds(TimeZone.getTimeZone("UTC"));
        boolean isWorn = intent.getExtras().getBoolean(NotifySchedulingService.NOTIFICATION_WORN);

        onUpdateWorn(utcDateLong, isWorn);

        // cancel notification
        NotificationManager notificationManager = (NotificationManager)
                this.getSystemService(Context.NOTIFICATION_SERVICE);
        notificationManager.cancel(NotifySchedulingService.NOTIFICATION_ID);
    }

    super.onNewIntent(intent);
}
 
开发者ID:istvank,项目名称:LensLog,代码行数:19,代码来源:MainActivity.java

示例2: getToday

import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
public static DateTime getToday() {
    return DateTime.today(TimeZone.getDefault());
}
 
开发者ID:nutritionfactsorg,项目名称:daily-dozen-android,代码行数:4,代码来源:Day.java

示例3: retrieveInitialArgs

import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
protected void retrieveInitialArgs() {
    // Get arguments
    Bundle args = getArguments();
    if (args != null) {
        // Get month, year
        month = args.getInt(MONTH, -1);
        year = args.getInt(YEAR, -1);


        // Get start day of Week. Default calendar first column is SUNDAY
        startDayOfWeek = args.getInt(START_DAY_OF_WEEK, 1);
        if (startDayOfWeek > 7) {
            startDayOfWeek = startDayOfWeek % 7;
        }

        int orientation = getResources().getConfiguration().orientation;
        if (orientation == Configuration.ORIENTATION_PORTRAIT) {
            squareTextViewCell = args.getBoolean(SQUARE_TEXT_VIEW_CELL, true);
        } else {
            squareTextViewCell = args.getBoolean(SQUARE_TEXT_VIEW_CELL, false);
        }

        // Get disable dates
        ArrayList<String> disableDateStrings = args
                .getStringArrayList(DISABLE_DATES);
        if (disableDateStrings != null && disableDateStrings.size() > 0) {
            disableDates.clear();
            for (String dateString : disableDateStrings) {
                DateTime dt = CalendarHelper.getDateTimeFromString(
                        dateString, "yyyy-MM-dd");
                disableDates.add(dt);
            }
        }

        // Get selected dates
        String selectedDateString = args
                .getString(SELECTED_DATES);
        if (selectedDateString != null ) {
            clearSelectedDates();
                selectedDate = CalendarHelper.getDateTimeFromString(
                        selectedDateString, "yyyy-MM-dd");
        }

        // Get min date and max date
        String minDateTimeString = args.getString(MIN_DATE);
        if (minDateTimeString != null) {
            minDateTime = CalendarHelper.getDateTimeFromString(
                    minDateTimeString, null);
        }

        String maxDateTimeString = args.getString(MAX_DATE);
        if (maxDateTimeString != null) {
            maxDateTime = CalendarHelper.getDateTimeFromString(
                    maxDateTimeString, null);
        }

        // Get theme
        themeResource = args.getInt(THEME_RESOURCE, R.style.CaldroidDefault);
    }
    if (month == -1 || year == -1) {
        DateTime dateTime = DateTime.today(TimeZone.getDefault());
        month = dateTime.getMonth();
        year = dateTime.getYear();
    }
}
 
开发者ID:maheswaranapk,项目名称:Andorid-Material-Drop-Down-Date-Picker,代码行数:66,代码来源:CalendarFragment.java

示例4: retrieveInitialArgs

import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
/**
 * Retrieve initial arguments to the fragment Data can include: month, year,
 * dialogTitle, showNavigationArrows,(String) disableDates, selectedDates,
 * minDate, maxDate
 */
protected void retrieveInitialArgs(Bundle savedInstanceState) {
	// Get arguments
	Bundle args = getArguments();
	if (args != null) {
		// Get month, year
		month = args.getInt(MONTH, -1);
		year = args.getInt(YEAR, -1);
		dialogTitle = args.getString(DIALOG_TITLE);
		Dialog dialog = getDialog();
		if (dialog != null) {
			if (dialogTitle != null) {
				dialog.setTitle(dialogTitle);
			} else {
				// Don't display title bar if user did not supply
				// dialogTitle
				dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
			}
		}

		// Get start day of Week. Default calendar first column is SUNDAY
		startDayOfWeek = args.getInt(START_DAY_OF_WEEK, 1);
		if (startDayOfWeek > 7) {
			startDayOfWeek = startDayOfWeek % 7;
		}

		// Should show arrow
		showNavigationArrows = args
				.getBoolean(SHOW_NAVIGATION_ARROWS, true);

		// Should enable swipe to change month
		enableSwipe = args.getBoolean(ENABLE_SWIPE, true);

		// Get sixWeeksInCalendar
		sixWeeksInCalendar = args.getBoolean(SIX_WEEKS_IN_CALENDAR, true);

		// Get clickable setting
		enableClickOnDisabledDates = args.getBoolean(ENABLE_CLICK_ON_DISABLED_DATES, false);

		// Get selected dates
		ArrayList<String> selectedDateStrings = args.getStringArrayList(SELECTED_DATES);
		if (selectedDateStrings != null && selectedDateStrings.size() > 0) {
			for (String dateString : selectedDateStrings) {
				DateTime dt = CalendarHelper.getDateTimeFromString(dateString, "yyyy-MM-dd");
				selectedDates.add(dt);
			}
		}

		// Get min date and max date
		String minDateTimeString = args.getString(MIN_DATE);
		if (minDateTimeString != null) {
			minDateTime = CalendarHelper.getDateTimeFromString(
					minDateTimeString, null);
		}

		String maxDateTimeString = args.getString(MAX_DATE);
		if (maxDateTimeString != null) {
			maxDateTime = CalendarHelper.getDateTimeFromString(
					maxDateTimeString, null);
		}

	}
	if (month == -1 || year == -1) {
		DateTime dateTime = DateTime.today(TimeZone.getDefault());
		month = dateTime.getMonth();
		year = dateTime.getYear();
	}
}
 
开发者ID:FrancescoDesogus,项目名称:IUM_Project_SwimDroid,代码行数:73,代码来源:CaldroidFragment.java

示例5: doInBackground

import hirondelle.date4j.DateTime; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(GenerateDataTaskParams... params) {
    if (params != null && params.length > 0) {
        taskParams = params[0];
    }

    deleteAllExistingData();

    final List<Food> allFoods = Food.getAllFoods();

    final int numDays = taskParams.getHistoryToGenerate();

    final DateTime today = DateTime.today(TimeZone.getDefault());
    DateTime current = today.minusDays(numDays);

    int i = 0;

    while (current.lteq(today)) {
        createServingsForDay(allFoods, current);

        publishProgress(++i, numDays);

        current = current.plusDays(1);
    }

    return null;
}
 
开发者ID:nutritionfactsorg,项目名称:daily-dozen-android,代码行数:28,代码来源:GenerateDataTask.java


注:本文中的hirondelle.date4j.DateTime.today方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。