Asked • 04/12/19

Change date format in a Java string?

I've a `String` representing a date. String date_s = "2011-01-18 00:00:00.0"; I'd like to convert it to a `Date` and output it in `YYYY-MM-DD` format > 2011-01-18 How can I achieve this?

1 Expert Answer

By:

Shao X. answered • 04/14/19

Tutor
4.9 (34)

I am a software engineer at Amazon

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.