I am working on a spring web application with support for multiple languages for the UI. Example form-model:
class PersonModel {
@DateTimeFormat(style = "M-")
private java.util.Date birthdate;
}
With this model and a birthdate January 13th, 2000 it renders to a form-input like:
"13.01.2000" (de_DE)
"13 Jan 2000" (en_GB)
German format is fine but I want the en_GB format to be like "13/01/2000". How can I customize it?
Using @DateTimeFormat(style = "S-") is sadly not an option because it renders the german year with just 2 digits.
"13.01.00" (de_DE)
"13/01/2000" (en_GB)
It seems it uses DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
under the hood. Spring Boot version is 2.7.18 but upgrade to version 3 is planned.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744714692a4589546.html
评论列表(0条)