Example usage for org.joda.time LocalDate now

List of usage examples for org.joda.time LocalDate now

Introduction

In this page you can find the example usage for org.joda.time LocalDate now.

Prototype

public static LocalDate now(Chronology chronology) 

Source Link

Document

Obtains a LocalDate set to the current system millisecond time using the specified chronology.

Usage

From source file:de.appsolve.padelcampus.data.TimeSlot.java

public boolean getPast() {
    LocalDate today = LocalDate.now(Constants.DEFAULT_TIMEZONE);
    LocalTime now = LocalTime.now(Constants.DEFAULT_TIMEZONE);
    return getDate().isBefore(today) || (getDate().equals(today) && getStartTime().isBefore(now));
}

From source file:it.elmariachistudios.mystorews.utils.DateTimeUtils.java

/**
 * Restituisce la data priva di ora in formato Java Date
 * @return la data senza orario in formato Java Date
 *///  ww  w . j av a 2  s . c  o m
public static Date getNowNoHourInJavaDate() {
    return LocalDate.now(DateTimeZone.forID("Europe/Rome")).toDate();
}

From source file:it.elmariachistudios.mystorews.utils.DateTimeUtils.java

/**
 * Restituisce la data priva di ora in formato Joda
 * @return la data in formato Joda senza ora
 *///from   w  w w  . j  a  v  a 2  s .  c  o  m
public static LocalDate getNowNoHourInJoda() {
    return LocalDate.now(DateTimeZone.forID("Europe/Rome"));
}

From source file:org.projectbuendia.client.ui.chart.LocalizedChartDataGridAdapter.java

License:Apache License

public LocalizedChartDataGridAdapter(Context context, List<LocalizedObs> observations, LocalDate admissionDate,
        LocalDate firstSymptomsDate, LayoutInflater layoutInflater) {
    mContext = context;/*from ww  w .j a v  a  2s.com*/
    LocalizedChartHelper localizedChartHelper = new LocalizedChartHelper(context.getContentResolver());
    mLayoutInflater = layoutInflater;
    Resources resources = context.getResources();
    mAdmissionDate = admissionDate;
    mFirstSymptomsDate = firstSymptomsDate;

    // Even though these Drawables are currently identical, referencing different drawables
    // for row headers and table cells ensures that RecyclerView does not improperly reuse
    // one as the other.
    this.mBackgroundLight = resources.getDrawable(R.drawable.chart_grid_background_light);
    this.mBackgroundDark = resources.getDrawable(R.drawable.chart_grid_background_dark);
    this.mRowHeaderBackgroundLight = resources.getDrawable(R.drawable.chart_grid_row_header_background_light);
    this.mRowHeaderBackgroundDark = resources.getDrawable(R.drawable.chart_grid_row_header_background_dark);

    Row row = null;
    TreeSet<LocalDate> days = new TreeSet<>();
    mToday = LocalDate.now(mChronology);
    for (LocalizedObs ob : observations) {
        // Observations come through ordered by the chart row, then the observation time, so we
        // want to maintain that order.
        if (row == null || !ob.conceptName.equals(row.mName)) {
            row = new Row(ob.conceptUuid, ob.conceptName);
            mRows.add(row);
        }

        if (ob.value == null || Concepts.UNKNOWN_UUID.equals(ob.value)
                || LocalizedChartHelper.NO_SYMPTOM_VALUES.contains(ob.value)) {
            // Don't display anything in the cell if there are no positive observations.
            continue;
        }

        DateTime obsDateTime = new DateTime(ob.encounterTimeMillis, mChronology);
        String columnId = toColumnId(obsDateTime);
        days.add(obsDateTime.toLocalDate());

        LOG.v("Column: %s, Observation: %s", columnId, ob.toString());
        if (row.mColumnIdsToLocalizedValues.containsKey(columnId)) {
            LOG.v("Overriding previous observation with value: %s",
                    row.mColumnIdsToLocalizedValues.get(columnId));
        }

        // If this is any bleeding site, also show a dot in the "any bleeding" row.
        if (Concepts.BLEEDING_SITES_NAME.equals(ob.groupName)) {
            mColumnIdsWithAnyBleeding.add(columnId);
        }

        // For notes, perform a concatenation rather than overwriting.
        if (Concepts.NOTES_UUID.equals(ob.conceptUuid)) {
            String oldText = row.mColumnIdsToValues.get(columnId);
            String newText = (oldText == null ? "" : oldText + "\n\n") + Dates.toMediumString(obsDateTime)
                    + "\n" + ob.value;
            row.mColumnIdsToValues.put(columnId, newText);
        } else {
            row.mColumnIdsToValues.put(columnId, ob.value);
        }

        row.mColumnIdsToLocalizedValues.put(columnId, ob.localizedValue);
    }

    // Create the list of all the columns to show.  Today and the admission date should
    // always be present, as well as any days between the last observation and today.
    days.add(mToday);
    if (admissionDate != null) {
        days.add(admissionDate);
    }
    LocalDate lastDay = days.last();
    for (LocalDate d = days.first(); !d.isAfter(lastDay); d = d.plus(Days.ONE)) {
        DateTime dayStart = d.toDateTimeAtStartOfDay();
        mColumnIds.add(toColumnId(dayStart));
        mColumnIds.add(toColumnId(dayStart.withHourOfDay(12)));
    }

    // If there are no observations, put some known rows to make it clearer what is being
    // displayed.
    if (mRows.isEmpty()) {
        List<LocalizedObs> emptyChart = localizedChartHelper.getEmptyChart(LocalizedChartHelper.ENGLISH_LOCALE);
        for (LocalizedObs ob : emptyChart) {
            mRows.add(new Row(ob.conceptUuid, ob.conceptName));
        }
    }
}