Click here to watch on Youtube:
https://www.youtube.com/watch?v=83xTS0MH0so&list=UUhwKlOVR041tngjerWxVccw
PeriodDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/PeriodDemo_addTo.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/PeriodDemo_addTo
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/b8bbbd8e3fa258805c096cde7ca05dcc526111c2/BasicJava_2018/PeriodDemo_addTo/?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
Cooking Tutorial
https://www.youtube.com/watch?v=83xTS0MH0so&list=UUhwKlOVR041tngjerWxVccw
PeriodDemo.java
import java.time.LocalDate;
import java.time.Period;
import java.time.temporal.Temporal;
public class PeriodDemo
{
public static void main(String[] args)
{
Period period = Period.ofDays(2);
System.out.println("period = " + period);
LocalDate localDate = LocalDate.now();
System.out.println("localDate = " + localDate);
/*
* Parameters:
*
* temporal - the temporal object to adjust, not null
*
* Returns:
*
* an object of the same type with the adjustment made, not
* null
*/
Temporal temporal = period.addTo(localDate);
System.out.println("temporal = "+temporal);
}
}
import java.time.Period;
import java.time.temporal.Temporal;
public class PeriodDemo
{
public static void main(String[] args)
{
Period period = Period.ofDays(2);
System.out.println("period = " + period);
LocalDate localDate = LocalDate.now();
System.out.println("localDate = " + localDate);
/*
* Parameters:
*
* temporal - the temporal object to adjust, not null
*
* Returns:
*
* an object of the same type with the adjustment made, not
* null
*/
Temporal temporal = period.addTo(localDate);
System.out.println("temporal = "+temporal);
}
}
Output
period = P2D
localDate = 2018-03-07
temporal = 2018-03-09
localDate = 2018-03-07
temporal = 2018-03-09
Click the below link to download the code:
https://sites.google.com/site/ramj2eev2/java_basics/PeriodDemo_addTo.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava_2018/PeriodDemo_addTo
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/b8bbbd8e3fa258805c096cde7ca05dcc526111c2/BasicJava_2018/PeriodDemo_addTo/?at=master
See also:
No comments:
Post a Comment