如何將毫秒數(shù)轉(zhuǎn)化為分鐘:秒數(shù)表示

如何將毫秒數(shù)轉(zhuǎn)化為分鐘:秒數(shù)表示

簡單的一個小例子:var oDate = new Date();var iM = oDate.getTime(); //得到毫秒數(shù)var nDate = new Date(iM0; //直接將毫秒數(shù)當(dāng)參數(shù)傳進(jìn)去。alert(nDate); //這個時候彈出的就是具體的 星期 月 日 年 時間 的格式了。

百科

怎么將毫秒數(shù)轉(zhuǎn)換成時間那種

pub

如何把int類型的毫秒數(shù)轉(zhuǎn)換成時間格式

思路是先用calendar.setTimeInMillis();方法取值,再用SimpleDateFormat()方法格式化日期比如:DateFormatformatter=newSimpleDateFormat(\”yyyy-MM-ddhh:mm:ss\”);longnow=System.currentTimeMillis();Calendarcalendar=Calendar.getInstance();calendar.setTimeInMillis(now);System.out.println(now+\”=\”+formatter.format(calendar.getTime()));