Convert storage date formats

All my code formats and displays dates as follows:

   3-1-2011
   3-15-2011
   12-1-2011
   12-15-2011

What is the best way to format this file as YYYY-MM-DD for storage in sqlite db?

+3
source share
1 answer

try it

   String inputDate =  "12-15-2011";
   DateFormat df = new SimpleDateFormat("YYYY-MM-DD");
   Date date = df.parse(inputDate);
+1
source

Source: https://habr.com/ru/post/1796415/


All Articles