androidandroid-dateandroid-dateutils

android date format: how to get the format from string


I am getting this 14-03-2014 09:02:10 string from JSON. All is OK but I want just the date part in this string not the time (14-03-2014). So how can I convert the string to this format.


Solution

  • If you already have the String, a substring would do the work:

    date = date.substring(0,10);