Click here to watch on Youtube :
https://www.youtube.com/watch?v=BW7gpO0dtCc&list=UUhwKlOVR041tngjerWxVccw
OffsetTimeDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/OffsetTimeDemo_plus_temporalAmount.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/OffsetTimeDemo_plus_temporalAmount
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/6f1f0d2759f060503c7b9e4a4259ae3ddbfe139e/BasicJava/OffsetTimeDemo_plus_temporalAmount/?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=BW7gpO0dtCc&list=UUhwKlOVR041tngjerWxVccw
OffsetTimeDemo.java
import java.time.Duration;
import java.time.OffsetTime;
public class OffsetTimeDemo
{
public static void main(String[] args)
{
OffsetTime offsetTime1 = OffsetTime.now();
System.out.println("offsetTime1 = " + offsetTime1);
Duration duration = Duration.ofHours(2);
System.out.println("duration = "+duration);
/*
* Parameters:
*
* amountToAdd - the amount to add, not null
*
* Returns:
*
* an OffsetTime based on this time with the addition made,
* not null
*/
OffsetTime offsetTime2 = offsetTime1.plus(duration);
System.out.println("offsetTime2 = " + offsetTime2);
}
}
import java.time.OffsetTime;
public class OffsetTimeDemo
{
public static void main(String[] args)
{
OffsetTime offsetTime1 = OffsetTime.now();
System.out.println("offsetTime1 = " + offsetTime1);
Duration duration = Duration.ofHours(2);
System.out.println("duration = "+duration);
/*
* Parameters:
*
* amountToAdd - the amount to add, not null
*
* Returns:
*
* an OffsetTime based on this time with the addition made,
* not null
*/
OffsetTime offsetTime2 = offsetTime1.plus(duration);
System.out.println("offsetTime2 = " + offsetTime2);
}
}
Output
offsetTime1 = 07:58:35.706+05:30
duration = PT2H
offsetTime2 = 09:58:35.706+05:30
duration = PT2H
offsetTime2 = 09:58:35.706+05:30
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/OffsetTimeDemo_plus_temporalAmount.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/OffsetTimeDemo_plus_temporalAmount
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/6f1f0d2759f060503c7b9e4a4259ae3ddbfe139e/BasicJava/OffsetTimeDemo_plus_temporalAmount/?at=master
See also:
No comments:
Post a Comment