Click here to watch on Youtube :
https://www.youtube.com/watch?v=GVDlV4Sy6aY&list=UUhwKlOVR041tngjerWxVccw
LocalDateTimeDemo.java
Output
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalDateTimeDemo_equal_after_before.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalDateTimeDemo_equal_after_before
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2732bd5046563d647669928b143687e5dbf4d99f/BasicJava/LocalDateTimeDemo_equal_after_before/?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=GVDlV4Sy6aY&list=UUhwKlOVR041tngjerWxVccw
LocalDateTimeDemo.java
import java.time.LocalDateTime;
public class LocalDateTimeDemo
{
public static void main(String[] args)
{
LocalDateTime localDateTime1 = LocalDateTime
.parse("2016-02-03T12:30:30");
System.out.println("localDateTime1 = "+localDateTime1);
LocalDateTime localDateTime2 = LocalDateTime
.parse("2017-03-03T12:30:30");
System.out.println("localDateTime2 = "+localDateTime2);
/*
* Returns:true if this is equal to the other date-time
*/
System.out.println(localDateTime1.equals(localDateTime2));
/*
* Returns:true if this date-time is after the specified
* date-time
*/
System.out.println(localDateTime1.isAfter(localDateTime2));
/*
* Returns:true if this date-time is before the specified
* date-time
*/
System.out.println(localDateTime1.isBefore(localDateTime2));
}
}
public class LocalDateTimeDemo
{
public static void main(String[] args)
{
LocalDateTime localDateTime1 = LocalDateTime
.parse("2016-02-03T12:30:30");
System.out.println("localDateTime1 = "+localDateTime1);
LocalDateTime localDateTime2 = LocalDateTime
.parse("2017-03-03T12:30:30");
System.out.println("localDateTime2 = "+localDateTime2);
/*
* Returns:true if this is equal to the other date-time
*/
System.out.println(localDateTime1.equals(localDateTime2));
/*
* Returns:true if this date-time is after the specified
* date-time
*/
System.out.println(localDateTime1.isAfter(localDateTime2));
/*
* Returns:true if this date-time is before the specified
* date-time
*/
System.out.println(localDateTime1.isBefore(localDateTime2));
}
}
Output
localDateTime1 = 2016-02-03T12:30:30
localDateTime2 = 2017-03-03T12:30:30
false
false
true
localDateTime2 = 2017-03-03T12:30:30
false
false
true
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LocalDateTimeDemo_equal_after_before.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LocalDateTimeDemo_equal_after_before
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/2732bd5046563d647669928b143687e5dbf4d99f/BasicJava/LocalDateTimeDemo_equal_after_before/?at=master
See also:
No comments:
Post a Comment