Alexander
Alexander

Reputation: 147

Remove minutes from @CreationTimestamp annotation

I am using an annotation @CreationTimestamp to write a date when a file is uploaded. How can I remove the minutes to leave only the year, month and day?

@Data
@Entity
@Table(name = "exchange_rates")
public class ExchangeRate {

///

    @CreationTimestamp
    @Column(name = "downloaddate")
    private Date downloaddate;
}

Upvotes: 0

Views: 125

Answers (1)

n-n-nebbl
n-n-nebbl

Reputation: 66

You can use @Temporal(TemporalType.DATE) to only store the date part.

Upvotes: 1

Related Questions