Get current second

Complete source code below, will show you how to get current computer second and print the value. The second value that it get is second value at program executing time.

>>Get current minute
>>Get current hour
>>Get current computer time in java

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


import java.util.Date;

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

//Get current second
int currentSecond=myDate.getSeconds();

//Print current second that we get
System.out.println("Current second is : "+currentSecond);
}
}


******************************************************************
JUST COMPILE AND EXECUTE IT
******************************************************************

Get current minute

Complete source code below will print current computer minute.

>>Get current second
>>Get current hour
>>Get current computer time in java

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


import java.util.Date;

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

//Get current minute
int currentMinute=myDate.getMinutes();

//Print current minute that we get
System.out.println("Current minute is : "+currentMinute);
}
}


*******************************************************************
JUST COMPILE AND EXECUTE IT
*******************************************************************

Get current hour

Complete source code below will print current computer hour in soldier time format.Soldier time format is 24 hour format.

>>Get current minute
>>Get current second
>>Get current computer time in java

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


import java.util.Date;

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

//Get current hour in soldier time format
int currentHour=myDate.getHours();

//Print current hour that we get
System.out.println("Current hour is : "+currentHour);
}
}


**************************************************************
JUST COMPILE AND EXECUTE IT
**************************************************************

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
*******************************************************************

RELAXING NATURE VIDEO