Search in sources :

Example 46 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project ETSMobile-Android2 by ApplETS.

the class SeanceComparator method compare.

@Override
public int compare(Seances seance1, Seances seance2) {
    DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss");
    DateTime seanceDay1 = formatter.parseDateTime(seance1.dateDebut);
    DateTime seanceDay2 = formatter.parseDateTime(seance2.dateDebut);
    if (seanceDay1.isAfter(seanceDay2)) {
        return 1;
    }
    if (seanceDay1.isBefore(seanceDay2)) {
        return -1;
    }
    return 0;
}
Also used : DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTime(org.joda.time.DateTime)

Example 47 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project ETSMobile-Android2 by ApplETS.

the class NewsComparator method compare.

@Override
public int compare(Nouvelle nouvelle1, Nouvelle nouvelle2) {
    DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd");
    DateTime dt1 = formatter.parseDateTime(nouvelle1.getDate());
    DateTime dt2 = formatter.parseDateTime(nouvelle2.getDate());
    if (dt1.isAfter(dt2)) {
        return -1;
    }
    if (dt1.isBefore(dt2)) {
        return 1;
    }
    return 0;
}
Also used : DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTime(org.joda.time.DateTime)

Example 48 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project ETSMobile-Android2 by ApplETS.

the class HoraireComparator method compare.

@Override
public int compare(IHoraireRows lhs, IHoraireRows rhs) {
    DateTimeFormatter formatter = null;
    DateTime eventDay1 = null;
    DateTime eventDay2 = null;
    if (lhs.getClass().equals(Event.class)) {
        formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
        eventDay1 = formatter.parseDateTime(lhs.getDateDebut());
    }
    if (rhs.getClass().equals(Event.class)) {
        formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
        eventDay2 = formatter.parseDateTime(rhs.getDateDebut());
    }
    if (lhs.getClass().equals(Seances.class)) {
        formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss");
        eventDay1 = formatter.parseDateTime(lhs.getDateDebut());
    }
    if (rhs.getClass().equals(Seances.class)) {
        formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss");
        eventDay2 = formatter.parseDateTime(rhs.getDateDebut());
    }
    if (eventDay1.isAfter(eventDay2)) {
        return 1;
    } else if (eventDay1.isBefore(eventDay2)) {
        return -1;
    } else if (eventDay1.isEqual(eventDay2)) {
        return 0;
    }
    return 0;
}
Also used : DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTime(org.joda.time.DateTime)

Example 49 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project ETSMobile-Android2 by ApplETS.

the class NewsAdapter method getView.

@SuppressLint("DefaultLocale")
@Override
public View getView(int position, View view, ViewGroup parent) {
    ViewHolder holder;
    if (view != null) {
        holder = (ViewHolder) view.getTag();
    } else {
        view = inflater.inflate(R.layout.row_news, parent, false);
        holder = new ViewHolder();
        holder.tvTitre = (TextView) view.findViewById(R.id.tv_row_news_titre);
        holder.tvDate = (TextView) view.findViewById(R.id.tv_row_news_date);
        holder.imageSource = (ImageView) view.findViewById(R.id.iv_news_image);
        view.setTag(holder);
    }
    Nouvelle item = getItem(position);
    String image = item.getUrlPicture();
    DateTimeFormatter dateTimeFormatter = DateTimeFormat.forPattern("yyyy-MM-dd");
    DateTime date = dateTimeFormatter.parseDateTime(item.getDate());
    holder.tvDate.setText(date.toString("dd MMM yyyy", Locale.CANADA_FRENCH));
    if (!image.equals("")) {
        Picasso.with(context).load(image).placeholder(R.drawable.loading_spinner).resize(300, 300).into(holder.imageSource);
    }
    holder.tvTitre.setText(item.getTitre());
    return view;
}
Also used : Nouvelle(ca.etsmtl.applets.etsmobile.model.Nouvelle) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTime(org.joda.time.DateTime) SuppressLint(android.annotation.SuppressLint)

Example 50 with DateTimeFormatter

use of org.joda.time.format.DateTimeFormatter in project OpenClinica by OpenClinica.

the class OpenClinicaBeanVariableNode method testCalculateVariable.

private String testCalculateVariable() {
    if (number.equals("_CURRENT_DATE")) {
        String ssTimeZone = getExpressionBeanService().getSSTimeZone();
        if (ssTimeZone.equals("") || ssTimeZone == null)
            ssTimeZone = TimeZone.getDefault().getID();
        DateTimeZone ssZone = DateTimeZone.forID(ssTimeZone);
        DateMidnight dm = new DateMidnight(ssZone);
        DateTimeFormatter fmt = ISODateTimeFormat.date();
        return fmt.print(dm);
    }
    return null;
}
Also used : DateMidnight(org.joda.time.DateMidnight) DateTimeFormatter(org.joda.time.format.DateTimeFormatter) DateTimeZone(org.joda.time.DateTimeZone)

Aggregations

DateTimeFormatter (org.joda.time.format.DateTimeFormatter)209 DateTime (org.joda.time.DateTime)95 Date (java.util.Date)40 Test (org.junit.Test)25 DateTimeZone (org.joda.time.DateTimeZone)19 ArrayList (java.util.ArrayList)16 HashMap (java.util.HashMap)16 SolrInputDocument (org.apache.solr.common.SolrInputDocument)12 IndexSchema (org.apache.solr.schema.IndexSchema)12 DateTimeFormatterBuilder (org.joda.time.format.DateTimeFormatterBuilder)12 CswSourceConfiguration (org.codice.ddf.spatial.ogc.csw.catalog.common.CswSourceConfiguration)10 IOException (java.io.IOException)9 Calendar (java.util.Calendar)8 Map (java.util.Map)8 DatasetConfigDTO (com.linkedin.thirdeye.datalayer.dto.DatasetConfigDTO)7 FormatDateTimeFormatter (org.elasticsearch.common.joda.FormatDateTimeFormatter)7 Test (org.testng.annotations.Test)7 TimeSpec (com.linkedin.thirdeye.api.TimeSpec)6 FilterType (net.opengis.filter.v_1_1_0.FilterType)6 Deployment (org.activiti.engine.test.Deployment)6