package com.iailab.module.data.video.hikvision.utils; import java.text.SimpleDateFormat; import java.util.Date; public class CommonUtils { /** *<p>获å–当å‰æ—¥æœŸ<p> *<p>æ ¼å¼yyyyMMdd<p> */ public static String getCurrDate(){ Date date=new Date(); SimpleDateFormat df1 = new SimpleDateFormat("yyyyMMdd"); String tDate = df1.format(date); return tDate; } /** *<p>获å–当å‰æ—¶é—´<p> *<p>æ ¼å¼yyyyMMddHHmmss<p> */ public static String getCurrDate2(){ Date date=new Date(); SimpleDateFormat df1 = new SimpleDateFormat("yyyyMMddHHmmss"); String tDate = df1.format(date); return tDate; } /** *<p>获å–当å‰æ—¶é—´<p> *<p>æ ¼å¼yyyy-MM-dd HH:mm:ss<p> */ public static String getCurrDate3(){ Date date=new Date(); SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String tDate = df1.format(date); return tDate; } /** * 由年月日时分秒+3ä½éšæœºæ•° * 生æˆæµæ°´å· * @return */ public static Long Getnum(){ String t = getCurrDate2(); int x=(int)(Math.random()*900)+100; String serial = t + x; Long num = new Long(serial); return num; } //主方法测试 public static void main(String[] args) { System.out.println(Getnum()); } }