Date日期格式修改
生活随笔
收集整理的這篇文章主要介紹了
Date日期格式修改
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);
@RequestMapping("/j2")@ResponseBodypublic String json2() throws JsonProcessingException {//jackson , ObjectMapperObjectMapper mapper = new ObjectMapper();Date date = new Date();//返回的date為時間戳SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//轉化為json字符串String str=mapper.writeValueAsString(simpleDateFormat.format(date));return str;}總結
以上是生活随笔為你收集整理的Date日期格式修改的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 技术人员的赚钱之道-7:“穷人”与“富人
- 下一篇: 生活随记 - 孩子教育