Mega Code Archive

 
Categories / Java Tutorial / Development
 

One-or-two digit hour on a 24-hour clock

import java.util.Date; public class MainClass {   public static void main(String[] args) {     Date now = new Date();     System.out.printf("one-or-two digit hour on a 24-hour clock: %tk/%Tk\n", now, now);   } } // one-or-two digit hour on a 24-hour clock: 11/11