user962206
user962206

Reputation: 16147

Joda-Time Convert String Date Time to Another Format

I have this String Feb-16-2015 00:00 how do I convert this to another Date Time String with AM/PM ?

Upvotes: 1

Views: 2939

Answers (1)

toadzky
toadzky

Reputation: 3846

First you will need to parse in into a Joda DateTime object, the call toString(String) to get a custom format.

DateTime dt = DateTime.parse("Feb-16-2015 00:00", DateTimeFormat.forPattern("MMM-dd-yyyy HH:mm"));
dt.toString("MMM-dd-yyyy hh:mm a");

Upvotes: 5

Related Questions