Pages

Get current computer time in java

Complete source code below will show you, how to get current computer time in java.

*******************************************************************
COMPLETE SOURCE CODE FOR : GetCurrentTime.java
*******************************************************************


import java.util.Date;

public class GetCurrentTime
{
public static void main(String[]args)
{
Date myDate=new Date();

System.out.println(myDate.getHours()+":"+myDate.getMinutes()+":"+myDate.getSeconds());
}
}


*******************************************************************
JUST COMPILE AND EXECUTE IT
*******************************************************************
Related Posts Plugin for WordPress, Blogger...