Display current time in 12 hour format with AM/PM

Easiest way to get it by using date pattern – h:mm a, where

  • h – Hour in am/pm (1-12)
  • m – Minute in hour
  • a – Am/pm marker

Code snippet :

DateFormat dateFormat = new SimpleDateFormat("hh:mm a");

Read more on documentation – SimpleDateFormat java 7

Leave a Comment