基板
This commit is contained in:
@@ -3,11 +3,14 @@ package com.quinn.utils;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
public class QuinnUtils {
|
||||
|
||||
private static final String ALLCHAR = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
private final static SimpleDateFormat sdf = new SimpleDateFormat( "yyyyMMdd");
|
||||
private final static SimpleDateFormat sdfv = new SimpleDateFormat( "yyyy-MM-dd");
|
||||
|
||||
public static String getUuid(){
|
||||
return UUID.randomUUID().toString().replaceAll("-","");
|
||||
@@ -21,4 +24,19 @@ public class QuinnUtils {
|
||||
return sdf.format(date);
|
||||
}
|
||||
|
||||
public static String getViewStrFromDate(Date date){
|
||||
return sdfv.format(date);
|
||||
}
|
||||
|
||||
public static String getCode(){
|
||||
int length = 6;
|
||||
//随机数
|
||||
StringBuffer sb = new StringBuffer();
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < length; i++) {
|
||||
sb.append(ALLCHAR.charAt(random.nextInt(ALLCHAR.length())));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user