Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert Local time to am/pm time format using JodaTime?

Tags:

java

jodatime

I'm very new to Joda api and I have the call like this:

 LocalTime time = new LocalTime("13");

it prints as:13:00:00.000.

I wish I could display it like this: 1:00 PM.

How I can achieve that?

Thanks in advance

like image 559
batman Avatar asked Sep 29 '22 23:09

batman


1 Answers

Try the following:

DateTimeFormatter builder = DateTimeFormat.forPattern("hh:mm:ss.SSa");
like image 76
ltalhouarne Avatar answered Oct 02 '22 11:10

ltalhouarne