Get the difference in months for a date.

If you want to know how many months is the difference between 2 dates. Here is the code for you I think the code is self explanatory. Using ChronoUnit.MONTHS.between() we can find the difference between the dates. Please do note how we use the LocalDate. If you need to handle specific locales, you would have … Read more

How to set Date to midnight in Java

Here is piece of the code that will help you with setting the Date to midnight in Java We take the Calender instance and set the time to the user date. After that we set the hour, minute, second and millis to 0. That gives us the Date set to midnight.

How to integrate different systems

The data that comes from various systems into an application should be handled in a way that we have to do minimum of the work for integration with different systems that provide data. Defined a common interface. All the systems that provide data have to provide a database that follows the interface specification. Application should … Read more

Search an enum by a unique attribute

I was recently defining an enum with some keys. But the enum needed more than a key. It also needed a configuration parameter that would define if this key has some special feature avaliable. So I defined the enum with a constructor that had 2 inputs, the key and the configuration boolean attribute. Now the … Read more