zoukankan      html  css  js  c++  java
  • String与Date转换

    public class TimeTraining {
    public static void changeStr(String str){
      str = "137878";
    }
    public static void main(String[] args){
    Date cur = new Date();
    SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String date = ft.format(cur);                                                                                            //format(convert time to string);
    System.out.println(date);
    try {
      Date tdate = ft.parse(date);                                                                                    //format(convert String to time);
      System.out.println(tdate);
    } catch (ParseException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
        }
      }
    }

  • 相关阅读:
    在列表中添加序号列
    在C#中使用正则表达式
    Git
    Linux 配置Java环境
    讯飞语义理解 JAVA SDK
    分屏显示
    Gdiplus
    重启进程
    MFC 常用功能属性
    MFC 打印
  • 原文地址:https://www.cnblogs.com/qcxdoit/p/7904317.html
Copyright © 2011-2022 走看看