Java Convert military hour to civilian hour with Joda time
<p>I'm trying to convert an int (which represents the military time hour) and convert it to its civilian time. For example if I have the hour "13" I want to convert it to "1:00 pm". Here's what I've been attempting:</p>

<pre><code>private DateTimeFormatter hourFormat = DateTimeFormat.forPattern("hh:mm a");
private DateTimeFormatter dateFormat = DateTimeFormat.forPattern("YYYY-MM-dd");

int hour = 8;
DateTime fullDate = new DateTime();
 String date = dateFormat.print(fullDate) + " " + Integer.toString(hour) + ":00";
String civilianTime = hourFormat.parseDateTime(date).toString();
</code></pre>

<p>Logcat:</p>

<pre><code>java.lang.IllegalArgumentException: Invalid format: "2016-01-27 8:00" is malformed at "16-01-27 8:00"
at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:945)
</code></pre>

<p>Joda doesn't allow me to just reformat the hour, I get a "8:00 too short" type of error so that is why I included the date and combined the date and time into one string even though I don't need date. I also have tried using a time zone component in there but I get the same error. Just for background: The int "hour" comes from timestamps (UTC w/ timezone offset) from a database query that spits out a list of  hours I need. So the hours I get back have already taken timezone into account. </p>

<p>In essence I'm trying to go from "HH" hour of day (0-23) to "hh:mm a" clockhour of halfday (1-12). I'm assuming sometimes the "HH" is just "H" because the leading zero is dropped when going from database query to the application. I've tried this with hour = 8 and hour = 10 with the same resulting error.</p>