Click here to watch on Youtube :
https://www.youtube.com/watch?v=PZGCY8EiHPU&list=UUhwKlOVR041tngjerWxVccw
ClockDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ClockDemo_tick_duration.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ClockDemo_tick_duration
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/1e79a72b731c44149257d4c3aece211de3cbaa86/BasicJava/ClockDemo_tick_duration/?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=PZGCY8EiHPU&list=UUhwKlOVR041tngjerWxVccw
ClockDemo.java
import java.time.Clock;
import java.time.Duration;
public class ClockDemo
{
public static void main(String[] args)
{
Clock baseClock = Clock.systemUTC();
System.out.println("instant of baseClock = " + baseClock.instant());
Duration tickDuration = Duration.ofDays(300);
System.out.println("tickDuration = " + tickDuration);
/*
* Parameters:
*
* baseClock - the base clock to base the ticking clock on,
* not null
*
* tickDuration - the duration of each visible tick, not
* negative, not null
*
* Returns:
*
* a clock that ticks in whole units of the duration,
* not null
*/
Clock clock = Clock.tick(baseClock, tickDuration);
System.out.println("instant of clock = " + clock.instant());
}
}
import java.time.Duration;
public class ClockDemo
{
public static void main(String[] args)
{
Clock baseClock = Clock.systemUTC();
System.out.println("instant of baseClock = " + baseClock.instant());
Duration tickDuration = Duration.ofDays(300);
System.out.println("tickDuration = " + tickDuration);
/*
* Parameters:
*
* baseClock - the base clock to base the ticking clock on,
* not null
*
* tickDuration - the duration of each visible tick, not
* negative, not null
*
* Returns:
*
* a clock that ticks in whole units of the duration,
* not null
*/
Clock clock = Clock.tick(baseClock, tickDuration);
System.out.println("instant of clock = " + clock.instant());
}
}
Output
instant of baseClock = 2018-02-13T03:41:00.886Z
tickDuration = PT7200H
instant of clock = 2017-08-22T00:00:00Z
tickDuration = PT7200H
instant of clock = 2017-08-22T00:00:00Z
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/ClockDemo_tick_duration.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/ClockDemo_tick_duration
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/1e79a72b731c44149257d4c3aece211de3cbaa86/BasicJava/ClockDemo_tick_duration/?at=master
See also:
No comments:
Post a Comment