Search in This Blog

Time in 24 Hours format in Java

How to show time in 24 Hours format.

Listed below the code; how to show time in 24 format in java

import java.io.*;
import java.util.*;
import java.util.Calendar;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;


public class Tm {
    public static void main(String[] args) {
        Date date = new Date();
    SimpleDateFormat simpDate;

    simpDate = new SimpleDateFormat("kk:mm:ss");
    System.out.println(simpDate.format(date));


    }
}
Previous
Next Post »