JAVA 8 / NOTES</>↗Java 816 Jul 2015
The example How do I check if a year is a leap year? use the java.util.Calendar object to determine if a given year is a leap year. That was the way to do it using the old API before we have the Date and Time API introduced in Java 8. Now, in the Java 8 […]
JAVA 8 / NOTES</>↗Java 812 Sep 2014
In this code snippet you will learn how to parse a string into an instance of LocalDate, LocalTime and LocalDateTime. All of these classes provide a parse() method that accept an argument of string that represent a valid date and time information and convert it into the corresponding object. If the string passed into the […]
JAVA 8 / NOTES</>↗Java 811 Sep 2014
The java.time.LocalDateTime class represents information of both date and time without time-zone. We can create LocalDateTime using the available static factory method such as the of() method or by combining an instance of LocalDate and LocalTime. The following code snippet will show you both ways. First we begin with using the of() method where we […]
JAVA 8 / NOTES</>↗Java 807 Sep 2014
An instance of LocalTime class represent information about time. It doesn’t contain information about date. To create an instance of this class we can use the of() static factory method. There are two types of this method. The first one accept two arguments, hour and minute. The second type also accept the second as the […]
JAVA 8 / NOTES</>↗Java 807 Sep 2014
JDK8’s LocateDate class is a class that represent information about date. It doesn’t include information about time of day, and it also doesn’t have information about time-zone. An instance of this class is an immutable object. To create an instance of LocateDate class we can use the of() static method factory. We pass arguments such […]
JAVA 8 / NOTES</>↗Java 805 Sep 2014
This example show you how to use the new Date and Time API introduced in JDK 8 to get the current date and time. To get today’s date in this new API you can construct an instance of LocalDate, LocalTime or LocalDateTime and call its toString() method. All of these classes are located under the […]