Java 获取并格式化当前时间

import java.util.*;
import java.text.*;
public class Date1 {

public static void main(String args[]) {
/*try {
long start = System.currentTimeMillis( );//获取此刻时间
Thread.sleep(5*60*10);
//再次获取此刻的时间
System.currentTimeMillis()
long end = System.currentTimeMillis( );
//计算时间间隔
long interval = end - start;
System.out.println("interval is : " + interval);
} catch (Exception e) {
System.out.println("Got an exception!");
}
}*/
Date dNow = new Date();
SimpleDateFormat ft = new SimpleDateFormat("yyyy MM dd hh:mm:ss a zzz E");
System.out.println(ft.format(dNow));
}
}

 

posted @ 2016-07-24 10:38  JungleHuter  阅读(257)  评论(0编辑  收藏  举报