1.

00-24的数字格式

import java.text.DecimalFormat;


List<String> list = new ArrayList<>();
        DecimalFormat df = new DecimalFormat("00");
        for(int i = 0; i < 24; i++){
            list.add(df.format(i));
        }

2.日期格式:

import java.time.format.DateTimeFormatter;

 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate.now().format(dtf)

3.保留两位小数:

DecimalFormat df = new DecimalFormat("0.00");
df.format(renRate * 0.997)

 

相关文章:

  • 2022-01-20
  • 2022-02-09
  • 2022-12-23
  • 2021-08-23
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
猜你喜欢
  • 2021-04-22
  • 2022-12-23
  • 2022-03-01
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案