Explore Courses Blog Tutorials Interview Questions
0 votes
in Java by (10.2k points)
I have a string "11/15/2013 08:00:00", I want to format it to "11/15/2013", what is the correct DateTimeFormatter pattern?

I've tried many and googled and still unable to find the correct pattern.

\I am looking for Joda-Time DateTimeFormatter, not Java's SimpleDateFormat..

1 Answer

0 votes
by (46k points)

I am adding this here even though the other answers are completely acceptable. JodaTime has parsers pre built in DateTimeFormat:


This is most of the options printed out with their format:

shortDate:         11/3/16

shortDateTime:     11/3/16 4:25 AM

mediumDate:        Nov 3, 2016

mediumDateTime:    Nov 3, 2016 4:25:35 AM

longDate:          November 3, 2016

longDateTime:      November 3, 2016 4:25:35 AM MDT

fullDate:          Thursday, November 3, 2016

fullDateTime:      Thursday, November 3, 2016 4:25:35 AM Mountain Daylight Time

Related questions

Browse Categories