Time Display USING JAVA
A program to show the current time using SimpleDateFormat Method.
import java.util.Date;
import java.text.SimpleDateFormat;
public class DateFormat {
public static void main(String[] args) {
Date date = new Date();
String strDateFormat = "HH:mm:ss a";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
System.out.println(sdf.format(date));
}
}
Output:
00:15:13 AM
Great site
ReplyDeleteHelping too
ReplyDeleteThis comment has been removed by the author.
ReplyDelete