public static void main(String[] args) throws SQLException, ClassNotFoundException, ParseException {
String x = "1304638584000";
long l = new Long(x).longValue();
System.out.println("Long value: " + l);
Calendar c = new GregorianCalendar();
c.setTimeInMillis(l);
String origDate =
c.get(Calendar.YEAR) + "-" +
c.get(Calendar.MONTH) + "-" +
(c.get(Calendar.MONTH)+1)+ "-" + +" " +
c.get(Calendar.HOUR)+":"+c.get(Calendar.MINUTE)+":"+c.get(Calendar.SECOND)
;
System.out.println("Date in YYYY-MM-DD format: " + origDate);
}
沒有留言:
張貼留言