• Unable to obtain LocalDateTime from TemporalAccessor
    20 February

    [Fixed] Unable to obtain LocalDateTime from TemporalAccessor

    In this article, we will see how to fix Unable to obtain LocalDateTime from TemporalAccessor in Java 8. Unable to obtain LocalDateTime from TemporalAccessor : Reason You will generally get this error, when you try to convert String to LocalDateTime and Formatted String does not have time related information. Let’s understand with the help of […]

  • Java LocalDate to Instant
    17 February

    Convert LocalDate to Instant in Java

    In this article, we will see how to convert LocalDate to Instant in Java. Java LocalDate to Instant Instant class provides an instantaneous point in time. When you want to convert LocalDate to Instant, you need to provide time zone. Using toInstant() wth ZoneId ZoneDateTime’s toInstant() method can be used to convert LocalDate to Instant. […]

  • Java Instant to LocalDate
    17 February

    Convert Instant to LocalDate in Java

    In this article, we will see how to convert Instant to LocalDate in java. Using ofInstant method [ Java 9+] Java 9 has introduced static method ofInstant() method in LocalDate class. It takes Instant and ZoneId as input and returns LocalDate object. [crayon-6288e5d432f6f344064667/] Let’s see with the help of example: [crayon-6288e5d432f74978629265/] Output: LocalDate Obj: 2022-01-23 […]

  • Convert String to LocalDateTime in Java
    17 February

    Convert String to LocalDateTime in Java

    In this article, we will see how to convert String to LocalDateTime in Java. LocalDateTime class was introduced in Java 8. LocalDateTime represents local date and time without timezone information. It is represented in ISO 8601 format (yyyy-MM-ddTHH:mm:ss) by default. Java String to LocalDateTime To convert String to LocalDateTime in Java, LocalDateTime provides static method […]

  • Java LocalDateTIme to String
    16 February

    Format LocalDateTime to String in Java

    In this article, we will see how to format LocalDateTime to String in java. Java LocalDateTime To String To format LocalDateTime to String, we can create DateTimeFormatter and pass it to LocalDateTime’s format() method. [crayon-6288e5d43333a344098575/] Here are steps: Get LocalDateTime instance Create DateTimeFormatter instance with specified format Pass above DateTimeFormatter to format() method to convert […]

  • Find duplicate elements in the Stream
    17 October

    Java 8 – Find duplicate elements in Stream

    Introduction When working with a collection of elements in Java, it is very common to have duplicate elements, and Java provides different APIs that we can use to solve the problem. Java 8 Stream provides the functionality to perform aggregate operations on a collection, and one of the operations includes finding duplicate elements. In this […]

  • Format Instant to String in java
    02 May

    How to format Instant to String in java

    Learn about how to format Instant to String in java.

  • Convert Date to LocalDate in java
    12 January

    Java Date to LocalDate

    In this post, we will see how to convert Date to LocalDate in java. Sometimes, we may need to convert Date to new Java 8 APIs and vice versa. There are multiple ways to convert Date to LocalDate in java. Read also: Convert LocalDate to Date in java Using toInstant() method of Date class You […]

  • Convert LocalDate to Date in java
    11 January

    Java LocalDate to Date

    In this post, we will see how to convert LocalDate to Date. Java 8 has introduced a lot of new APIs for Date and time. There can be many ways to convert Java LocalDateTime to date. Using Instant object You can convert LocalDate to Date using Instant object which we can from Zone. Here is […]