zoukankan      html  css  js  c++  java
  • java工具类10-时间工具类

    public class DateUtil {
    //时间毫秒转日期格式 public static String longToDate(String s) { long milliSecond = Long.valueOf(s).longValue(); Date date = new Date(); date.setTime(milliSecond); String format = new SimpleDateFormat("yyyyMMdd").format(date); return format; } //创建日期文件夹 public static String createFileBySysTime(String path) { // 1. 读取系统时间 Calendar calendar = Calendar.getInstance(); Date time = calendar.getTime(); // 2. 格式化系统时间 SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); //获取系统当前时间并将其转换为string类型,fileName即文件名 String fileName = format.format(time); // 3. 创建文件夹 String newPath = path + fileName; File file = new File(newPath); //如果文件目录不存在则创建目录 if (!file.exists()) { if (!file.mkdir()) { System.out.println(newPath+": Current path does not exist, creation failed"); return null; } } //System.out.println("创建成功" + newPath); return newPath; } }
  • 相关阅读:
    flask基础 MUI
    flask基础 MongoDB
    falsk 基础 语音识别与语音合成()
    flask基础 websocket ()
    flask基础四 请求上下文()
    flask基础三
    学习整理
    Elasticsearch
    课程学习:Linux系统管理
    课程学习:程序设计与算法
  • 原文地址:https://www.cnblogs.com/chong-zuo3322/p/12855413.html
Copyright © 2011-2022 走看看