package com.cr.time;
import java.util.Date;
public class Time {
public static void main(String[] args) {
// TODO Auto-generated method stub
String strDate = "";
String strTime = "";
Date objDate = new Date();
System.out.println("今天的日期是:" + new Date());
long time = objDate.getTime();
System.out.println("自1970年7月1日起,"
+ "以毫秒为单位的时间(GMT):" + time);
strDate = objDate.toString();
strTime = strDate.substring(11, (strDate.length() - 4));
strTime = "时间: " + strTime.substring(0 , 8);
System.out.println(strTime);
}
}
import java.util.Date;
public class Time {
public static void main(String[] args) {
// TODO Auto-generated method stub
String strDate = "";
String strTime = "";
Date objDate = new Date();
System.out.println("今天的日期是:" + new Date());
long time = objDate.getTime();
System.out.println("自1970年7月1日起,"
+ "以毫秒为单位的时间(GMT):" + time);
strDate = objDate.toString();
strTime = strDate.substring(11, (strDate.length() - 4));
strTime = "时间: " + strTime.substring(0 , 8);
System.out.println(strTime);
}
}