package util; /** * 验证码生成类 */ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Random; public class CheckCode { public String getCheckCode(){ Random random = new Random(); String sRand=""; for (int i=0;i<4;i++){ String rand=String.valueOf(random.nextInt(10)); sRand+=rand; } return sRand; } public static void main(String[] args) { String timeStr="2011-10-18 15:24:25"; DateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date=null; long timeLong=0; long timeAdded=0; try{ date=df.parse(timeStr); timeLong=date.getTime(); System.out.println("long:"+timeLong); Calendar c=Calendar.getInstance(); c.setTime(date); c.add(Calendar.MINUTE,40); timeAdded=c.getTimeInMillis(); System.out.println("Added time:"+c.getTime()); System.out.println("Added 40 minutes:"+timeAdded); }catch(ParseException e){ e.printStackTrace(); } } }
最近下载更多
asddwh LV12
2023年12月29日
hongdongdong LV12
2023年6月17日
3038606153 LV1
2023年4月14日
微信网友_5768552477921280 LV6
2022年11月2日
qwqiwiw LV4
2022年7月18日
263648 LV7
2022年6月23日
JohnssyWT LV1
2022年6月10日
我睡觉时不困 LV7
2022年6月5日
zzfzzf LV7
2022年4月22日
wanglinddad LV54
2022年4月8日
最近浏览更多
玖零定制问题修复 LV34
4月4日
呀呀呀yayayawawawa
1月12日
暂无贡献等级
Liang朝伟 LV1
1月6日
yangyangyangyangzzzz LV1
1月3日
asddwh LV12
2023年12月26日
weilaizhisheng LV21
2023年12月26日
2716804680 LV9
2023年11月11日
wersdfs LV1
2023年9月9日
阳光男孩阿葵
2023年7月14日
暂无贡献等级
asadda LV2
2023年6月26日