- import java.util.*;
- class GetCurrentDateAndTime
- {
- public static void main(String args[])
- {
- System.out.println("Welcome To Date/Time by kidshelp & Computerwizardi");
- int day, month, year;
- int second, minute, hour;
- GregorianCalendar date = new GregorianCalendar();
- day = date.get(Calendar.DAY_OF_MONTH);
- month = date.get(Calendar.MONTH);
- year = date.get(Calendar.YEAR);
- second = date.get(Calendar.SECOND);
- minute = date.get(Calendar.MINUTE);
- hour = date.get(Calendar.HOUR);
- System.out.println("Current date is "+day+"/"+(month+1)+"/"+year);
- System.out.println("Current time is "+hour+" : "+minute+" : "+second);
- }
- }
Free ICSE, NCERT, CBSE solutions for classes 1 to 12. Get Free Workbook solutions along with free notes and much more
Monday, 21 July 2014
Java Program to Print Date And Time
Subscribe to:
Post Comments (Atom)
I am flabbergasted with the amount of information i have been able to scoop from this article. thanks fotr sharing as i look forward to your next article.
ReplyDelete