List of usage examples for org.joda.time DateMidnight DateMidnight
public DateMidnight()
ISOChronology
in the default time zone. From source file:com.github.dbourdette.otto.web.form.ReportForm.java
License:Apache License
/** * Ensures that from and to attributes are valid *//*from w ww . java 2 s . c om*/ private void fixAdvancedParams() { if (from == null) { from = new DateMidnight().toDate(); } if (to == null) { to = new DateMidnight().toDate(); } }
From source file:com.github.dbourdette.otto.web.util.IntervalUtils.java
License:Apache License
public static Interval yesterday() { return new Interval(new DateMidnight().minusDays(1), new DateMidnight()); }
From source file:com.github.dbourdette.otto.web.util.IntervalUtils.java
License:Apache License
public static Interval today() { return new Interval(new DateMidnight(), new DateMidnight().plusDays(1)); }
From source file:com.github.dbourdette.otto.web.util.IntervalUtils.java
License:Apache License
public static Interval lastWeek() { DateMidnight monday = new DateMidnight().withDayOfWeek(1); return new Interval(monday.minusDays(7), monday); }
From source file:com.github.dbourdette.otto.web.util.RandomDateUtils.java
License:Apache License
public static DateTime today() { return in(new Interval(new DateMidnight(), new DateMidnight().plusDays(1))); }
From source file:com.github.dbourdette.otto.web.util.RandomDateUtils.java
License:Apache License
public static DateTime last7Days() { return in(new Interval(new DateMidnight().minusDays(6), new DateMidnight().plusDays(1))); }
From source file:com.google.android.apps.paco.Experiment.java
License:Open Source License
public boolean hasFreshInputs() { if (!isQuestionsChange()) { return true; }//from w ww .j ava 2 s . c om DateMidnight dateMidnight = new DateMidnight(); for (Input input : getInputs()) { if (dateMidnight.isEqual(new DateMidnight(input.getScheduleDate().getTime()))) { return true; } } return false; }
From source file:com.google.android.apps.paco.ExperimentExecutor.java
License:Open Source License
private void renderInputs() { if (experiment.isQuestionsChange()) { DateMidnight dateMidnight = new DateMidnight(); boolean hadQuestionForToday = false; for (Input input : experiment.getInputs()) { if (dateMidnight.isEqual(new DateMidnight(input.getScheduleDate().getTime()))) { hadQuestionForToday = true; InputLayout inputView = renderInput(input); inputs.add(inputView);//from www .j a v a2s. com inputsScrollPane.addView(inputView); } } } else { for (Input input : experiment.getInputs()) { InputLayout inputView = renderInput(input); inputs.add(inputView); inputsScrollPane.addView(inputView); inputView.addChangeListener(this); } //setNextActionOnOpenTexts(); } }
From source file:com.google.android.apps.paco.ExperimentProviderUtil.java
License:Open Source License
public List<Long> getJoinedExperimentServerIds() { List<Experiment> joinedExperiments = getJoinedExperiments(); List<Experiment> stillRunningExperiments = Lists.newArrayList(); DateMidnight tonightMidnight = new DateMidnight().plusDays(1); for (Experiment experiment : joinedExperiments) { String endDate = experiment.getEndDate(); if (experiment.isFixedDuration() != null && experiment.isFixedDuration() || endDate == null || endDateFormatter.parseDateTime(endDate).isAfter(tonightMidnight)) { stillRunningExperiments.add(experiment); }//from w w w .j a v a2 s .c o m } List<Long> experimentIds = Lists.transform(stillRunningExperiments, new Function<Experiment, Long>() { public Long apply(Experiment experiment) { return experiment.getServerId(); } }); return experimentIds; }
From source file:com.google.android.apps.paco.ExperimentScheduleActivity.java
License:Open Source License
private void showEsmScheduleConfiguration() { setContentView(R.layout.esm_schedule); TextView title = (TextView) findViewById(R.id.experimentNameSchedule); title.setText(experiment.getExperimentDAO().getTitle()); startHourField = (Button) findViewById(R.id.startHourTimePickerLabel); startHourField.setText(new DateMidnight().toDateTime() .withMillisOfDay(schedule.getEsmStartHour().intValue()).toString(TIME_FORMAT_STRING)); endHourField = (Button) findViewById(R.id.endHourTimePickerLabel); endHourField.setText(new DateMidnight().toDateTime().withMillisOfDay(schedule.getEsmEndHour().intValue()) .toString(TIME_FORMAT_STRING)); // TODO (bobevans): get rid of this duplication startHourField.setOnClickListener(new OnClickListener() { public void onClick(View v) { final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ExperimentScheduleActivity.this); unsetTimesViewParent();/*from w w w.jav a 2s . c om*/ dialogBuilder.setView(timesScheduleLayout); final AlertDialog dialog = dialogBuilder.setTitle(R.string.start_time_title).create(); Long offset = schedule.getEsmStartHour(); DateTime startHour = new DateMidnight().toDateTime().withMillisOfDay(offset.intValue()); timePicker.setCurrentHour(startHour.getHourOfDay()); timePicker.setCurrentMinute(startHour.getMinuteOfHour()); dialog.setButton(Dialog.BUTTON_POSITIVE, getString(R.string.save_button), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { schedule.setEsmStartHour(getHourOffsetFromPicker()); startHourField.setText(getTextFromPicker(schedule.getEsmStartHour().intValue())); } }); dialog.show(); } }); // endHourField.setOnClickListener(new OnClickListener() { public void onClick(View v) { final AlertDialog.Builder endHourDialogBuilder = new AlertDialog.Builder( ExperimentScheduleActivity.this); unsetTimesViewParent(); endHourDialogBuilder.setView(timesScheduleLayout); final AlertDialog endHourDialog = endHourDialogBuilder.setTitle(R.string.end_time_title).create(); Long offset = schedule.getEsmEndHour(); DateTime endHour = new DateMidnight().toDateTime().withMillisOfDay(offset.intValue()); timePicker.setCurrentHour(endHour.getHourOfDay()); timePicker.setCurrentMinute(endHour.getMinuteOfHour()); endHourDialog.setButton(Dialog.BUTTON_POSITIVE, getString(R.string.save_button), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { schedule.setEsmEndHour(getHourOffsetFromPicker()); endHourField.setText(getTextFromPicker(schedule.getEsmEndHour().intValue())); } }); endHourDialog.show(); } }); }