package ro.ieval.unical;
+import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
final TextView date = (TextView) rowView.findViewById(R.id.alarm_datetime);
final Button delete = (Button) rowView.findViewById(R.id.alarm_delete);
delete.setOnClickListener(new DeleteListener(getItem(position)));
- date.setText(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.UK).format(getItem(position)));
+ date.setText(DateFormat.getDateTimeInstance().format(getItem(position)));
return rowView;
}
final Date start=new Date(event.dtstart);
final Date end=new Date(event.dtend);
- final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.UK);
- final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss", Locale.UK);
- final SimpleDateFormat dayOfWeekFormat = new SimpleDateFormat("EEEEEEE", Locale.UK);
+ final DateFormat dateFormat = DateFormat.getDateInstance();
+ final DateFormat timeFormat = DateFormat.getTimeInstance();
+ final DateFormat dayOfWeekFormat = new SimpleDateFormat("EEEEEEE", Locale.UK);
startDay.setText(dayOfWeekFormat.format(start));
if(!dateFormat.format(start).equals(dateFormat.format(end))) {
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
+import java.text.DateFormat;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
final TextView dstart = (TextView) rowView.findViewById(R.id.smalldatestart);
final TextView dend = (TextView) rowView.findViewById(R.id.smalldateend);
final View header = rowView.findViewById(R.id.rowHeader);
+ final DateFormat format = DateFormat.getDateTimeInstance();
header.setBackgroundColor(events[position].eventColour);
title.setText(events[position].title);
- dstart.setText(new Date(events[position].dtstart).toString());
- dend.setText(new Date(events[position].dtend).toString());
+ dstart.setText(format.format(new Date(events[position].dtstart)));
+ dend.setText(format.format(new Date(events[position].dtend)));
return rowView;
}