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;
}
CodePudding user response:
Use this :
@CreationTimestamp
@Temporal(TemporalType.DATE)
@Column(name = "downloaddate")
private LocalDate downloaddate;
CodePudding user response:
You can use @Temporal(TemporalType.DATE)
to only store the date part.