From 80e77e678543e171f81ad5309f25b297b04192ea Mon Sep 17 00:00:00 2001 From: Juan Miguel Boyero Corral Date: Sat, 7 Apr 2012 18:21:10 +0200 Subject: [PATCH] Fixed date and time format --- .../notifications/NotificationsCursorAdapter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/SWADroid/src/es/ugr/swad/swadroid/modules/notifications/NotificationsCursorAdapter.java b/SWADroid/src/es/ugr/swad/swadroid/modules/notifications/NotificationsCursorAdapter.java index 44b6170f..5a0f40b3 100644 --- a/SWADroid/src/es/ugr/swad/swadroid/modules/notifications/NotificationsCursorAdapter.java +++ b/SWADroid/src/es/ugr/swad/swadroid/modules/notifications/NotificationsCursorAdapter.java @@ -80,8 +80,9 @@ public class NotificationsCursorAdapter extends CursorAdapter { String type = ""; String sender, senderFirstname, senderSurname1, senderSurname2, summaryText; String contentText, contentMsgText; - String[] dateContent; - Date d; + Date d; + java.text.DateFormat dateShortFormat = android.text.format.DateFormat.getDateFormat(context); + java.text.DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(context); int numRows = cursor.getCount(); if(contentVisible.length == 0) { @@ -153,9 +154,8 @@ public class NotificationsCursorAdapter extends CursorAdapter { if((eventDate != null) && (eventTime != null)){ unixTime = Long.parseLong(cursor.getString(cursor.getColumnIndex("eventTime"))); d = new Date(unixTime * 1000); - dateContent = d.toLocaleString().split(" "); - eventDate.setText(dateContent[0]); - eventTime.setText(dateContent[1]); + eventDate.setText(dateShortFormat.format(d)); + eventTime.setText(timeFormat.format(d)); } if(eventSender != null){ sender = "";