嗨我有一個要求毫秒轉換爲日期。日期應該可以被MYSQL接受。從毫秒轉換到MYSQL日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("US/Central"));
calendar.setTimeInMillis(System.currentTimeMillis());
System.out.println("GregorianCalendar -" + sdf.format(calendar.getTime()));
我嘗試這樣做的例子,但這裏 「sdf.format(calendar.getTime()」 這個方法在下面的格式其給予串 「YYYY-MM-DD HH:MM:SS」。
但我想Date對象,也即是在上述格式(YYYY-MM-DD HH:MM:SS)。
那麼,如何可以將其轉換爲日期格式
請幫我在這。 ...
Thanx預先... :)
日期沒有格式。 –