Tag Archives: Java-Period

Given two dates start_date and end_date with time in the form of strings, the task is to find the difference between two dates in Java.… Read More
The ofYears(int numberOfYears) method of Period class is used to get a period from the given number of years as parameter. The obtained period will… Read More
The withMonths() method of Period Class is used to obtain a period with specified number of months. This number of months is passed as the… Read More
The withYears() method of Period Class is used to obtain a period with specified number of years. This number of years is passed as the… Read More
The withDays() method of Period Class is used to obtain a period with specified number of days. This number of days is passed as the… Read More
The toTotalMonths() method of Period Class is used to obtain the total number of Months in the given period. It returns a long value depicting… Read More
The ofDays() method of Period Class is used to obtain a period from given number of Days as parameter. This parameter is accepted in the… Read More
The ofWeeks() method of Period Class is used to obtain a period from given number of Weeks as parameter. This parameter is accepted in the… Read More
The ofMonths() method of Period Class is used to obtain a period from given number of Months as parameter. This parameter is accepted in the… Read More
The of() method of Period Class is used to obtain a period from given number of Years, Months, and Days as parameters. These parameters are… Read More
The parse() method of Period Class is used to obtain a period from given string in the form of PnYnMnD where nY means n years,… Read More
The minusYears() method of Period class in Java is used to subtract the specified years from given period. This functions operates only on YEARS and… Read More
The getDays() method of Period class in Java is used to get the number of days in this current period with which it is used.… Read More
The equals() method of Period class in Java is used to check if two given periods are equal or not. The comparison is based on… Read More
The getYears() method of Period in Java is used to get the amount of years of this period whit which it is used. Note: 15… Read More