Click here to watch on Youtube :
https://www.youtube.com/watch?v=ILHMBS39y-g&list=UUhwKlOVR041tngjerWxVccw
ClockDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ClockDemo_tickminutes.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ClockDemo_tickminutes
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/f479c67d9d2a797db17daef3132e32f3fda78b25/BasicJava/ClockDemo_tickminutes/?at=master
See also:
All JavaEE Videos Playlist
All JavaEE Videos
All JAVA EE Links
Servlets Tutorial
All Design Patterns Links
JDBC Tutorial
Java Collection Framework Tutorial
JAVA Tutorial
Kids Tutorial
https://www.youtube.com/watch?v=ILHMBS39y-g&list=UUhwKlOVR041tngjerWxVccw
ClockDemo.java
import java.time.Clock;
import java.time.ZoneId;
public class ClockDemo
{
public static void main(String[] args)
{
Clock clock1 = Clock.systemDefaultZone();
System.out.println("clock1 = " + clock1.instant());
/*
* Parameters:
*
* zone - the time-zone to use to convert the instant to
* date-time, not null
*
* Returns:
*
* a clock that ticks in whole minutes using the
* specified zone, not null
*/
Clock clock2 = Clock.tickMinutes(ZoneId.systemDefault());
System.out.println("clock2 = " + clock2.instant());
}
}
import java.time.ZoneId;
public class ClockDemo
{
public static void main(String[] args)
{
Clock clock1 = Clock.systemDefaultZone();
System.out.println("clock1 = " + clock1.instant());
/*
* Parameters:
*
* zone - the time-zone to use to convert the instant to
* date-time, not null
*
* Returns:
*
* a clock that ticks in whole minutes using the
* specified zone, not null
*/
Clock clock2 = Clock.tickMinutes(ZoneId.systemDefault());
System.out.println("clock2 = " + clock2.instant());
}
}
Output
clock1 = 2018-02-13T04:01:38.294Z
clock2 = 2018-02-13T04:01:00Z
clock2 = 2018-02-13T04:01:00Z
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ClockDemo_tickminutes.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ClockDemo_tickminutes
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/f479c67d9d2a797db17daef3132e32f3fda78b25/BasicJava/ClockDemo_tickminutes/?at=master
See also:
No comments:
Post a Comment