From f79ca8d00dd09df1989e9cd36e1598cb1673cc51 Mon Sep 17 00:00:00 2001 From: Jacques Foucry Date: Thu, 11 Aug 2016 17:41:14 +0200 Subject: [PATCH] Ajout convertion date millisecondes vers date --- app/src/main/java/net/foucry/pilldroid/UtilDate.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/main/java/net/foucry/pilldroid/UtilDate.java b/app/src/main/java/net/foucry/pilldroid/UtilDate.java index 29c60eb..058b3ca 100644 --- a/app/src/main/java/net/foucry/pilldroid/UtilDate.java +++ b/app/src/main/java/net/foucry/pilldroid/UtilDate.java @@ -105,4 +105,11 @@ public class UtilDate { return (int) (todayDate.getTime() - oldDate.getTime()); } + + public static String convertDate(long dateInMilliseconds) { + DateFormat formatter = new SimpleDateFormat("YYYY/mm/dd hh:MM:ss"); + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(dateInMilliseconds); + return formatter.format(calendar.getTime()); + } }