'How to select date only from database that storing dob as datatype timestamp without timezone in java

I have a table in PostgreSQL that stores dob as datatype timestamp without timezone example value '1997-12-03 07:00:00'.

My entity class is as follows

    @Table(name = "customer")
    public class Customer implements Serializable{ 
        @Id
        @GeneratedValue(strategy = GenerationType.SEQUENCE)
        @Column(name = "id",unique = true)
        private Long id;

    
        @Column(name = "username")
        @NotNull(message = "username cannot be empty")
        private String username ;

        @Column(name = "dob")
        @JsonFormat(pattern="yyyy-MM-dd")
        private Date dob; 
    }

I want to find all users with dob '1997-12-03'. But as it has a timestamp it's not returning any value. How it can get dob without timestamp using query without changing the datatype of dob?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source