Here is again a free utility to the show current time.
Java Program :
import java.util.*;
class time_display
{
static void time()
{
Calendar c=new GregorianCalendar();
String apm;
if(c.get(Calendar.AM_PM)==0)
apm = "AM";
else
apm = "PM";
System.out.print("\fDate : "+c.get(Calendar.DAY_OF_MONTH)+" / "+c.get(Calendar.MONTH)+" / "+c.get(Calendar.YEAR));
System.out.print("\n\nTime : "+c.get(Calendar.HOUR)+" : "+c.get(Calendar.MINUTE)+" : "+c.get(Calendar.SECOND)+" "+apm);
try{Thread.sleep(1000);}
catch(Exception e){}
time();
}
}
Java Program :
import java.util.*;
class time_display
{
static void time()
{
Calendar c=new GregorianCalendar();
String apm;
if(c.get(Calendar.AM_PM)==0)
apm = "AM";
else
apm = "PM";
System.out.print("\fDate : "+c.get(Calendar.DAY_OF_MONTH)+" / "+c.get(Calendar.MONTH)+" / "+c.get(Calendar.YEAR));
System.out.print("\n\nTime : "+c.get(Calendar.HOUR)+" : "+c.get(Calendar.MINUTE)+" : "+c.get(Calendar.SECOND)+" "+apm);
try{Thread.sleep(1000);}
catch(Exception e){}
time();
}
}
No comments:
Post a Comment