LocalData时间简单使用和Java中JSON字符串写法

//获取到当前传过来的月份并对其进行类型转换
 LocalDate startDate = LocalDate.parse(ltcCountDeviationVo.getEndDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));

 //获取本月的上一个月的26号
 LocalDate lastMonth = startDate.plusMonths(-1);
 LocalDate lastTwentySixDay = LocalDate.of(lastMonth.getYear(), lastMonth.getMonth(), 26);

 //获取本月25号
 LocalDate thisTwentyFiveMonth = LocalDate.of(startDate.getYear(), startDate.getMonth(), 25);

====================================================================

String json = "{\"data1\":[{\"name\":\"aa\",\"age\":\"12\"},{\"name\":\"bb\",\"age\":\"13\"}],\"data2\":{\"nowpage\":1,\"pagesize\":2}}" ;

中\为转义字符。\"表示一个"的意思,所以上面的json确实是JSON格式的字符串

一、转义字符是一类特殊的字符:

1、展示无法’看见‘的字符

2、与语言本身语法有冲突的字符

\n   换行

\t    横向制表符

\'    单引号

\n 换行

\r 回车

>>> print('hello \n world')
hello 
 world
>>> print('hello \\n world')
hello \n world

 

猜你喜欢

转载自blog.csdn.net/qq_40390762/article/details/124792558