zoukankan      html  css  js  c++  java
  • 时间戳

     1     @RequestMapping("/j3")
     2     public String JsonDome3() throws JsonProcessingException {
     3         ObjectMapper mapper = new ObjectMapper();
     4         Date date = new Date();
     5         //自定义日期的格式
     6         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd:HH:mm:ss");
     7         String s = simpleDateFormat.format(date);
     8         //ObjectMapper 时间解析后悔的默认格式为:Timestamp  时间戳
     9         return  mapper.writeValueAsString(s);
    10         //"2020-04-12:23:41:12"
    11     }

    时间戳

    1     @RequestMapping("/j3")
    2     public String JsonDome3() throws JsonProcessingException {
    3         ObjectMapper mapper = new ObjectMapper();
    4 
    5 
    6         Date date = new Date();
    7 
    8         return  mapper.writeValueAsString(date);
    9     }
  • 相关阅读:
    linux安装软件的几种方式
    linux目录
    linux远程连接
    linux分区
    linux特殊符号
    sed
    rest_framework认证流程
    一些面试题目
    算法之二分法
    算法之动态规划
  • 原文地址:https://www.cnblogs.com/rzkwz/p/12688744.html
Copyright © 2011-2022 走看看