Posts

Showing posts with the label Date

how to find total weekends between two dates in java

Image
In this article we are going to learn about Date class in Java and also placed few of the examples to find total weekends between two dates and to find Saturday and Sunday's in the current year. In this article we are going to use Serializable, Cloneable and Comparable in Java. If you should have basic knowledge about these interfaces, good enough. Date: Date class is part of java.util package. Which will specify the current date with Time. In other words, the Date class represents specific instant in time, with milliseconds precision. Date class inherits methods from the super class called Object. Internal declaration of Date class is as follows, public class Date extends Object implements Serializable , Cloneable , Comparable < T > As per the above lines, Date class implements Serializable, Cloneable, Comparable interfaces on top of Java super class called Object. How to create Date object? Since, Date is a normal class, we can create object directly