zoukankan      html  css  js  c++  java
  • apache.commons.lang3_DateFormatUtils,RandomStringUtils

    <pre name="code" class="java">System.out.println(DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
    //output 2015-05-04 18:50:54
    System.out.println(DateFormatUtils.format(new Date(), "yyyy-MM-dd hh:mm:ss"));
    //output 2015-05-04 06:50:22
    		
    System.out.println(DateUtils.addDays(new Date(), 1));//增加天数,时间。。等
    System.out.println(DateUtils.isSameDay(new Date(), new Date()));//是否相同日期
    System.out.println(DateUtils.parseDate("2015-05-04", "yyyy-MM-dd"));//str to Date
    System.out.println(RandomStringUtils.randomNumeric(6));//生成随机六位数字   数字参数可以更改
    System.out.println(RandomStringUtils.randomAlphabetic(6));//生成随机六位字母
    System.out.println(RandomStringUtils.randomAlphanumeric(6));//生成随机六位字母数字组合
    System.out.println(RandomStringUtils.random(6, true, true));//六位 第一个boolean 是否包含字母,第二个是否包含数字
    System.out.println(RandomStringUtils.random(6, "abcdefghigkqqqiiiiqq"));//生成六位随机,按给出的字母中取得

    </pre>

  • 相关阅读:
    627. Swap Salary
    176. Second Highest Salary
    596. Classes More Than 5 Students
    183. Customers Who Never Order
    181. Employees Earning More Than Their Managers
    182. Duplicate Emails
    175. Combine Two Tables
    620. Not Boring Movies
    595. Big Countries
    HDU 6034 Balala Power! (贪心+坑题)
  • 原文地址:https://www.cnblogs.com/liubo6/p/4491113.html
Copyright © 2011-2022 走看看