Quantcast
Channel: HowToDoInJava
Browsing all 49 articles
Browse latest View live

Java 8 – DayOfWeek

Java example to determine which day of the week is a given date. The weekdays are from Sunday, Monday till Saturday. 1. DayOfWeek Enum DayOfWeek is an enum representing the seven days of the week –...

View Article


Java 8 – Add or subtract N business days to date

Learn to add or subtract a given number of business days to LocalDate instance in Java 8. The given example takes the holiday list as well into consideration. 1. Adding business days To add business...

View Article


Java 8 – Calculate business days between two dates

Learn to count the number of business days between two given dates in Java 8. The given example takes the holiday list as an optional list and uses predicates to check weekends or holidays. Calculate...

View Article

Java 8 – Calculate days between two dates

Learn to calculate number of days between two dates in Java 8 using ChronoUnit.DAYS.between() and LocalDate.until() methods. Read More : Calculate business days between two dates 1....

View Article

Java – Get All Dates Between Two Dates

Learn to get all the dates between the two given dates. We will see the solutions in Java 7, Java 8, and Java 9. 1. LocalDate.datesUntil() – Java 9 LocalDate‘s datesUntil() method returns a sequential...

View Article


Java 8 – Date Parsing and Validation

Learn to validate if a given string contains a date value or not. We will learn various date validation techniques available in Java 7, Java 8 and beyond. 1. DateTimeFormatter – Java 8 Best chances are...

View Article

Java – Date Formatting

Learn to format a date to string in Java 8. We will learn to use inbuilt patterns in DateTimeFormatter and custom patterns with SimpleDateFormat in Java 7. 1. DateTimeFormatter – Java 8 In Java 8, We...

View Article

Java 8 – TemporalAdjusters

Learn to use Java 8 TemporalAdjusters where we want to deal with recurring dates such as processing weekly reports, sending automated monthly report outs, etc. 1. TemporalAdjuster interface The...

View Article


Java 8 – Period

Learn to find the difference between two dates in date-based values such as days, months, years, weeks, or years using Java 8 Period class in the ISO-8601 calendar system. 1. Period class The Period...

View Article

Browsing all 49 articles
Browse latest View live