新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
java獲取隨機時間的源碼片段
將寫內(nèi)容過程中重要的一些內(nèi)容做個記錄,如下資料是關于java獲取隨機時間的片段的內(nèi)容。
成都創(chuàng)新互聯(lián)公司專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務,包含不限于成都網(wǎng)站設計、網(wǎng)站制作、西豐網(wǎng)絡推廣、小程序開發(fā)、西豐網(wǎng)絡營銷、西豐企業(yè)策劃、西豐品牌公關、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運營等,從售前售中售后,我們都將竭誠為您服務,您的肯定,是我們最大的嘉獎;成都創(chuàng)新互聯(lián)公司為所有大學生創(chuàng)業(yè)者提供西豐建站搭建服務,24小時服務熱線:18982081108,官方網(wǎng)址:www.cdcxhl.com
import java.text.parseexception;
import java.text.simpledateformat;
import java.util.date;
public class getrandomtiem {
public static void main(string []args){
simpledateformat format = new simpledateformat("hh:mm:ss");
date randomdate=randomdate("00:00:00","24:59:59");
string randomdats="shi"+randomdate.gethours()+"f"+randomdate.getminutes()+"m"+randomdate.getseconds();
system.out.println(randomdats);
}
private static date randomdate(string begindate,string enddate ){
try {
simpledateformat format = new simpledateformat("hh:mm:ss");
if(start.gettime() >= end.gettime()){
return null;
}
long date = random(start.gettime(),end.gettime());
return new date(date);
} catch (exception e) {
e.printstacktrace();
}
return null;
}
private static long random(long begin,long end){
if(rtn == begin || rtn == end){
return random(begin,end);
}
return rtn;
}
}
網(wǎng)站欄目:java獲取隨機時間的源碼片段
分享網(wǎng)址:http://fisionsoft.com.cn/article/iggdoh.html