Shared publicly  - 
 
 
In Android, to get a properly formatted and localized date/time value that respects your regional language and 24 hour preference settings, e.g., "Nov 28, 2012 15:42", use this code:

   String datePattern = ((SimpleDateFormat) DateFormat.getMediumDateFormat(BIMobile.getAppContext())).toLocalizedPattern();
   String timePattern = ((SimpleDateFormat) DateFormat.getTimeFormat(BIMobile.getAppContext())).toLocalizedPattern();
   String dateTimePattern = datePattern + " " + timePattern;
   SimpleDateFormat dateTimeFormat = new SimpleDateFormat(dateTimePattern );

You'll also need to use the 

   @SuppressLint("SimpleDateFormat")

annotation to get rid of Lint warnings.
1
Add a comment...