• Timestamp 使用


    Timestamp是一个长整形的类型

    1.使用方法一

    Timestamp nowdate1 = new Timestamp(System.currentTimeMillis()); System.out.println("System.currentTimeMillis():"+nowdate1);

    2. 使用方法二

    Date date = new Date();   
          Timestamp nowdate2 = new Timestamp(date.getTime());
      System.out.println("new Date():"+nowdate2)
    

    3. 使用方法三

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      Timestamp nowdate = new Timestamp(System.currentTimeMillis());
      String datestr = sdf.format(nowdate);
      System.out.println(datestr);
    
     
     
    如对您有帮助,请多多支持,谢谢。
     
     

  • 相关阅读:
    PCB 设计文件中哪些可以不做成元件
    IAR 9+ 编译 TI CC2541 出现 Segment ISTACK (size: 0xc0 align: 0) is too long for segment definition.
    每日一条 git 命令行:git clone https://xxxxx.git -b 12.0 --depth 1
    FastAdmin Bootstrap-table 特定某行背景变红
    如何查看 ThinkPHP5.1 的升级说明
    Windows 2008 关闭远程桌面的单用户多会话模式
    来测试一下你的“金耳朵”
    笔记:关于网站的流量攻击
    排序算法视频 《6 分钟演示 15 种排序算法》
    【转】移动web页面支持弹性滚动的3个方案
  • 原文地址:https://www.cnblogs.com/chaoren399/p/5158975.html
Copyright © 2020-2023  润新知