Front and rear Date type replacement

Since the date type passed from the front end to the back end is a json type string, type conversion is required

First, set a String type variable corresponding to the date type in the entity class, and use the String type as a transit

Accept and use the String type for front-end type conversion, and use the data type for interaction with the database

String to date type:

new SimpleDateFormat("yyyy-MM-dd").parse(user.getBirthdayStr())

The data type is loaded with String type:

new SimpleDateFormat("yyyy-MM-dd").format(birthday)


Guess you like

Origin blog.51cto.com/14954398/2667392