zoukankan      html  css  js  c++  java
  • 时间输出

    1.  /** 单独输出年月日时分秒等 */  
    2.         Calendar c = Calendar.getInstance();  
    3.         System.out.println("年: " + c.get(Calendar.YEAR));  
    4.         // 月份从0开始,加1校正  
    5.         System.out.println("月: " + (c.get(Calendar.MONTH) + 1) + "");  
    6.         System.out.println("日: " + c.get(Calendar.DAY_OF_MONTH));  
    7.         System.out.println("时: " + c.get(Calendar.HOUR_OF_DAY));  
    8.         System.out.println("分: " + c.get(Calendar.MINUTE));  
    9.         System.out.println("秒: " + c.get(Calendar.SECOND));  
    10.         System.out.println("当前时间毫秒数:" + c.getTimeInMillis());  
    11.         System.out.println("当前时间: " + c.getTime());  
  • 相关阅读:
    解释之前遗留的方法覆盖问题
    多态在开发中的作用
    多态的基础语法
    Go 统计汉子字符
    Go map
    Go make和new的区别
    Go 指针
    Go 切片
    Go数组
    Go中交换两个值类型
  • 原文地址:https://www.cnblogs.com/zh-0802/p/6104241.html
Copyright © 2011-2022 走看看