提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用日历以毫秒为单位获取时间
import java.util.Calendar; public class Main { /* NowJava.com 提 供 */ public static void main(String[] args) { Calendar now = Calendar.getInstance(); System.out.println("Current milliseconds since Jan 1, 1970 are :" + now.getTimeInMillis()); } }