
com.hc360.hcpay.payment.util.UtilDate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of payment-util Show documentation
Show all versions of payment-util Show documentation
hcpay payment-util java sdk
The newest version!
package com.hc360.hcpay.payment.util;
import java.util.Date;
import java.util.Random;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
/* *
*??????UtilDate
*???ܣ??Զ??嶩????
*??ϸ???????࣬??????????ȡϵͳ???ڡ???????ŵ?
*?汾??3.3
*???ڣ?2012-08-17
*˵????
*???´???ֻ??Ϊ?˷????̻????Զ??ṩ?????????룬?̻????Ը????Լ???վ????Ҫ?????ռ????ĵ???д,????һ??Ҫʹ?øô??롣
*?ô??????ѧϰ???о??۸????ӿ?ʹ?ã?ֻ???ṩһ???ο???
*/
public class UtilDate {
/** ??????ʱ????(???»???) yyyyMMddHHmmss */
public static final String dtLong = "yyyyMMddHHmmss";
/** ????ʱ?? yyyy-MM-dd HH:mm:ss */
public static final String simple = "yyyy-MM-dd HH:mm:ss";
/** ??????(???»???) yyyyMMdd */
public static final String dtShort = "yyyyMMdd";
/**
* ????ϵͳ??ǰʱ??(??ȷ??????),??Ϊһ??Ψһ?Ķ??????
* @return
* ??yyyyMMddHHmmssΪ??ʽ?ĵ?ǰϵͳʱ??
*/
public static String getOrderNum(){
Date date=new Date();
DateFormat df=new SimpleDateFormat(dtLong);
return df.format(date);
}
/**
* ??ȡϵͳ??ǰ????(??ȷ??????)????ʽ??yyyy-MM-dd HH:mm:ss
* @return
*/
public static String getDateFormatter(){
Date date=new Date();
DateFormat df=new SimpleDateFormat(simple);
return df.format(date);
}
/**
* ??ȡϵͳ??????????(??ȷ????)????ʽ??yyyyMMdd
* @return
*/
public static String getDate(){
Date date=new Date();
DateFormat df=new SimpleDateFormat(dtShort);
return df.format(date);
}
/**
* ???????????λ??
* @return
*/
public static String getThree(){
Random rad=new Random();
return rad.nextInt(1000)+"";
}
}