Calendar
import java.util.Calendar;public class Calander
{
public static void main(String[] args)
{
Calendar now = Calendar.getInstance();
int hrs = now.get(Calendar.HOUR_OF_DAY);
int min = now.get(Calendar.MINUTE);
int sec = now.get(Calendar.SECOND);
int years = now.get(Calendar.YEAR);
int month = now.get(Calendar.MONTH) + 1;
int day = now.get(Calendar.DATE);
System.out.println("NOW TIME");
System.out.println(hrs+":"+min+":"+sec);
System.out.println("\n\nNOW DATE");
System.out.println(years+"/"+month+"/"+day);
}
}
No comments:
New comments are not allowed.