Processing of springmvc page time format

 

Processing of springmvc page time format

 

 

1,

 

public  Date  date;

 //Don't forget to add the time zone, otherwise the difference is 8 hours

    @JsonFormat(pattern="yyyy-MM-ddHH:mm:ss",timezone = "GMT+8")

    publicjava.util.Date getOrderTime () {

        returnthis.orderTime;

}

Added to the javaBean property get method

Convert time data to json data

 

 

SQL formatted time method

DATE_FORMAT(A.ORDER_TIME,'%Y-%c-%d %H:%i:%s')    AS  orderTime,

 

 

2,

 

 

@DateTimeFormat(pattern="yyyy-MM-ddHH:mm:ss") 

public  string  date;

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326077531&siteId=291194637