返回自此日期對象所表示的1970年1月1日,00:00:00 GMT以來的毫秒數(shù)。
public long getTime()
沒有。
自此日期起的1970年1月1日,00:00:00 GMT以來的毫秒數(shù)。
下面是一個(gè)使用這個(gè)方法的例子 -
class Example { static void main(String[] args) { Date olddate = new Date("05/11/2015"); Date newdate = new Date("05/11/2015"); Date latestdate = new Date(); System.out.println(olddate.getTime()); System.out.println(newdate.getTime()); System.out.println(latestdate.getTime()); } }
當(dāng)我們運(yùn)行上面的程序,我們將得到以下結(jié)果 -
1431288000000 1431288000000 1449769878348
更多建議: