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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations