Search code examples
androiddate-format

Android Formatting Date


I need help with formatting date in Android. I have learned how to implement date like this yyyy-MM-dd but now I want like this Dec 31, 1969. How can I implement this dateFormat in Java?


Solution

  • SimpleDateFormat sdf  = new SimpleDateFormat("MMM d, yyyy");
    System.out.println(sdf.format(new Date()));
    

    It will return the Date at your requested format!