zoukankan      html  css  js  c++  java
  • 获取系统当前日期,分布获取年月日和时分秒

    package com.sinosoft.lis.controller.f1print;

    import java.text.SimpleDateFormat;
    import java.util.Date;

    public class Test {
    public static void main(String[] args) {
    第一种:分割
    // SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
    // System.out.println(df.format(new Date()).split(" ")[0]);// new Date()为获取当前系统时间 2020-10-10
    // System.out.println(df.format(new Date()).split(" ")[1]);// new Date()为获取当前系统时间 08:58:32
    第二种:分别获取
    // SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");//设置日期格式
    // SimpleDateFormat df2 = new SimpleDateFormat("HH:mm:ss");//设置日期格式
    // String yearAndMonthAndDay = df1.format(new Date());
    // String hourSecond = df2.format(new Date());
    // System.out.println(yearAndMonthAndDay);// new Date()为获取当前系统时间
    // System.out.println(hourSecond);// new Date()为获取当前系统时间


    第三种截取
    //SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
    //System.out.println(df.format(new Date()).substring(0,10));// new Date()为获取当前系统时间
    //System.out.println(df.format(new Date()).substring(11,19));// new Date()为获取当前系统时间
    }
    }

    搭上这一生命的列车,感受这生命的起点与终点
  • 相关阅读:
    freemaker获取字符串长度
    freemarker截取字符串subString
    [转]freemarker中的list
    python常用模块——os模块
    python正则表达式
    需要区分对比的函数以及函数小结
    信道极限容量
    信道和调制
    python中颜色设置
    python中的exec()、eval()以及complie()
  • 原文地址:https://www.cnblogs.com/s999/p/13733761.html
Copyright © 2011-2022 走看看