“Feder -Boot -Formatzeit” Code-Antworten

Die Federannotation für DateTimeFormat -Muster

@Entity
@Table(name = "pets")
public class Pet extends NamedEntity {
  @DateTimeFormat(pattern = "yyyy-MM-dd")
  private LocalDate birthDate;
Shy Sheep

Feder -Boot -Formatzeit

import java.sql.Date;
import java.sql.Time;
@Entity
public class Order{
  //format time
  @JsonFormat(pattern="HH:mm:ss")
  private Time orderTime;
  //forma date
  @JsonFormat(pattern="yyyy-MM-dd")
  private Date orderDate;
}
//if you are using spring data rest you can send a POST request like this
/*
{
  "orderTime":"20:00:00",
  "orderDate":"2022-01-01"
}
*/
Happy conding (●'◡'●) 
Wa7ch Tennin

Ähnliche Antworten wie “Feder -Boot -Formatzeit”

Fragen ähnlich wie “Feder -Boot -Formatzeit”

Weitere verwandte Antworten zu “Feder -Boot -Formatzeit” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen