Getting the current date
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Vinatha_Kandikattu
Posted On:   Wednesday, August 14, 2002 02:45 PM


Can anyone tell me how to print the current system date in java? I tried the methods in the Date class, but no success.

Re: Getting the current date

Posted By:   Rob_Eamon  
Posted On:   Friday, August 16, 2002 06:37 PM

Date rightNow = new Date();

System.out.println(rightNow.toString());

Re: Getting the current date

Posted By:   Sarada_Lakhamraju  
Posted On:   Wednesday, August 14, 2002 03:41 PM

Hello vinatha,

You can get the current with the following code

Calendar rightNow = Calendar.getInstance();


Calendar's getInstance method returns a GregorianCalendar object whose time fields have been initialized with the current date and time .

Cheers,

Sarada

About | Sitemap | Contact