Mega Code Archive

 
Categories / Java Tutorial / Development
 

Hours, minutes, and seconds on a 12-hour clock

import java.util.Date; public class MainClass {   public static void main(String[] args) {     Date now = new Date();     System.out.printf("hours, minutes, and seconds on a 12-hour clock: %tr/%Tr\n", now, now);    } } hours, minutes, and seconds on a 12-hour clock: 03:57:55 PM/03:57:55 PM