NumberFormat注解 DateTimeFormat

Posted 薛小生

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NumberFormat注解 DateTimeFormat相关的知识,希望对你有一定的参考价值。

public class Student {
    private String name;
    private Integer gender;
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date birth;
    @NumberFormat(pattern="#,###")
    private Integer salary;
    

    public Student(String name, Integer gender, Date birth, Integer salary) {
        super();
        this.name = name;
        this.gender = gender;
        this.birth = birth;
        this.salary = salary;
    }
}

在提交时就可以时间格式写成这样

工资写成这样:

 

以上是关于NumberFormat注解 DateTimeFormat的主要内容,如果未能解决你的问题,请参考以下文章

spring

修改 NumberFormat.getCurrencyInstance() 返回的 NumberFormat

NumberFormat类

NumberFormat类

Intl.NumberFormat#format 最大整数值

NumberFormat/ DecimalFormat